File tree 6 files changed +142
-154
lines changed
6 files changed +142
-154
lines changed Original file line number Diff line number Diff line change
1
+ < div x-data ="quote() " x-init ="fetchQuote() ">
2
+ < template x-if ="isLoaded() ">
3
+ < template x-if ="success ">
4
+ < a :href ="link " target ="_blank "
5
+ class ="inline-block py-2 pl-4 my-2 text-orange-300 border-l-4 border-orange-300 " x-text ="quote ">
6
+ </ a >
7
+ </ template >
8
+ < template x-if ="!success ">
9
+ < p class ="py-2 my-2 text-sm text-red-300 " x-text ="quote ">
10
+ </ p >
11
+ </ template >
12
+ </ template >
13
+ < template x-if ="!isLoaded() ">
14
+ < p class ="py-2 my-2 text-sm text-gray-300 ">
15
+ Loading quote of the day...
16
+ </ p >
17
+ </ template >
18
+ </ div >
19
+
20
+ < script >
21
+ const quote = ( ) => {
22
+ return {
23
+ quote : '' ,
24
+ author : '' ,
25
+ link : '' ,
26
+ success : false ,
27
+ isLoaded ( ) {
28
+ return this . quote !== ''
29
+ } ,
30
+ fetchQuote ( ) {
31
+ const url = "/.netlify/functions/quote" ;
32
+
33
+ fetch ( url )
34
+ . then ( response => response . json ( ) )
35
+ . then ( data => {
36
+ this . success = data . success ;
37
+ this . quote = this . success ? `${ data . quote . text } - ${ data . quote . author } ` : data . error
38
+ this . link = this . success ? data . quote . link : ''
39
+
40
+ console . log ( 'Loaded quote. Success: ' + this . success )
41
+ } ) ;
42
+ }
43
+ }
44
+ }
45
+ </ script >
Original file line number Diff line number Diff line change 9
9
10
10
< link rel ="stylesheet " type ="text/css " href ="{{ site.baseurl }}/assets/css/main.css ">
11
11
< meta name ="theme-color " content ="#ffffff ">
12
-
12
+
13
13
< link href ="https://fonts.googleapis.com/css2?family=Abril+Fatface&family=Josefin+Sans&display=swap " rel ="stylesheet ">
14
14
< script src ="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.3.5/dist/alpine.min.js " defer > </ script >
15
15
</ head >
16
16
17
17
< body >
18
- {{ content }}
18
+ < div class ="bg-gray-700 ">
19
+ < div class ="container mx-auto md:flex md:flex-row md:items-center md:justify-center md:h-screen ">
20
+ < div class ="p-8 md:w-1/2 md:max-w-lg md:order-last ">
21
+ {{ content }}
22
+ </ div >
23
+ < div class ="p-8 md:w-1/2 md:max-w-sm ">
24
+ < img src ="/assets/splash.svg " alt ="landscape ">
25
+ </ div >
26
+ </ div >
27
+ </ div >
19
28
</ body >
20
29
21
30
</ html >
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments