-
Notifications
You must be signed in to change notification settings - Fork 256
/
Copy pathapp-home.ts
168 lines (144 loc) · 4.32 KB
/
app-home.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
import { LitElement, css, html } from 'lit';
import { property, customElement } from 'lit/decorators';
// For more info on the @pwabuilder/pwainstall component click here https://github.com/pwa-builder/pwa-install
import '@pwabuilder/pwainstall';
@customElement('app-home')
export class AppHome extends LitElement {
// For more information on using properties and state in lit
// check out this link https://lit.dev/docs/components/properties/
@property() message = 'Welcome!';
static get styles() {
return css`
#welcomeBar {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
#welcomeBar fast-card {
margin-bottom: 12px;
}
#welcomeCard,
#infoCard {
padding: 18px;
padding-top: 0px;
}
pwa-install {
position: absolute;
bottom: 16px;
right: 16px;
}
button {
cursor: pointer;
}
@media (min-width: 1200px) {
#welcomeCard,
#infoCard {
width: 40%;
}
}
@media (screen-spanning: single-fold-vertical) {
#welcomeBar {
flex-direction: row;
align-items: flex-start;
justify-content: space-between;
}
#welcomeCard {
margin-right: 64px;
}
}
@media(prefers-color-scheme: light) {
fast-card {
--background-color: white;
}
}
`;
}
constructor() {
super();
}
async firstUpdated() {
// this method is a lifecycle even in lit
// for more info check out the lit docs https://lit.dev/docs/components/lifecycle/
console.log('This is your home page');
}
share() {
if ((navigator as any).share) {
(navigator as any).share({
title: 'PWABuilder pwa-starter',
text: 'Check out the PWABuilder pwa-starter!',
url: 'https://github.com/pwa-builder/pwa-starter',
});
}
}
render() {
return html`
<div>
<div id="welcomeBar">
<fast-card id="welcomeCard">
<h2>${this.message}</h2>
<p>
For more information on the PWABuilder pwa-starter, check out the
<fast-anchor
href="https://github.com/pwa-builder/pwa-starter/blob/master/README.md"
appearance="hypertext"
>README</fast-anchor
>.
</p>
<p>
Welcome to the
<fast-anchor href="https://pwabuilder.com" appearance="hypertext"
>PWABuilder</fast-anchor
>
pwa-starter! Be sure to head back to
<fast-anchor href="https://pwabuilder.com" appearance="hypertext"
>PWABuilder</fast-anchor
>
when you are ready to ship this PWA to the Microsoft, Google Play
and Samsung Galaxy stores!
</p>
${'share' in navigator
? html`<fast-button appearance="primary" @click="${this.share}"
>Share this Starter!</fast-button
>`
: null}
</fast-card>
<fast-card id="infoCard">
<h2>Technology Used</h2>
<ul>
<li>
<fast-anchor
href="https://www.typescriptlang.org/"
appearance="hypertext"
>TypeScript</fast-anchor
>
</li>
<li>
<fast-anchor
href="https://lit.dev"
appearance="hypertext"
>lit</fast-anchor
>
</li>
<li>
<fast-anchor
href="https://www.fast.design/docs/components/getting-started"
appearance="hypertext"
>FAST Components</fast-anchor
>
</li>
<li>
<fast-anchor
href="https://vaadin.github.io/vaadin-router/vaadin-router/demo/#vaadin-router-getting-started-demos"
appearance="hypertext"
>Vaadin Router</fast-anchor
>
</li>
</ul>
</fast-card>
</div>
<pwa-install>Install PWA Starter</pwa-install>
</div>
`;
}
}