From df52915806db050a8e0cfab2d686acfdbf5e0c5c Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 8 Mar 2023 19:27:35 +0300 Subject: Initial commit --- src/pages/app-about/about-styles.ts | 11 +++ src/pages/app-about/app-about.ts | 45 ++++++++++++ src/pages/app-home.ts | 138 ++++++++++++++++++++++++++++++++++++ 3 files changed, 194 insertions(+) create mode 100644 src/pages/app-about/about-styles.ts create mode 100644 src/pages/app-about/app-about.ts create mode 100644 src/pages/app-home.ts (limited to 'src/pages') diff --git a/src/pages/app-about/about-styles.ts b/src/pages/app-about/about-styles.ts new file mode 100644 index 0000000..001bd3f --- /dev/null +++ b/src/pages/app-about/about-styles.ts @@ -0,0 +1,11 @@ +import { css } from 'lit'; + +// these styles can be imported from any component +// for an example of how to use this, check /pages/about-about.ts +export const styles = css` + @media(min-width: 1000px) { + sl-card { + max-width: 70vw; + } + } +`; \ No newline at end of file diff --git a/src/pages/app-about/app-about.ts b/src/pages/app-about/app-about.ts new file mode 100644 index 0000000..1e148d8 --- /dev/null +++ b/src/pages/app-about/app-about.ts @@ -0,0 +1,45 @@ +import { LitElement, html } from 'lit'; +import { customElement } from 'lit/decorators.js'; + +// You can also import styles from another file +// if you prefer to keep your CSS seperate from your component +import { styles } from './about-styles'; + +import { styles as sharedStyles } from '../../styles/shared-styles' + +import '@shoelace-style/shoelace/dist/components/card/card.js'; + +@customElement('app-about') +export class AppAbout extends LitElement { + static styles = [ + sharedStyles, + styles + ] + + constructor() { + super(); + } + + render() { + return html` + + +
+

About Page

+ + +

Did you know?

+ +

PWAs have access to many useful APIs in modern browsers! These + APIs have enabled many new types of apps that can be built as PWAs, such as advanced graphics editing apps, games, + apps that use machine learning and more! +

+ +

Check out these + docs to learn more about the advanced features that you can use in your PWA

+
+
+ `; + } +} diff --git a/src/pages/app-home.ts b/src/pages/app-home.ts new file mode 100644 index 0000000..748e276 --- /dev/null +++ b/src/pages/app-home.ts @@ -0,0 +1,138 @@ +import { LitElement, css, html } from 'lit'; +import { property, customElement } from 'lit/decorators.js'; + +import '@shoelace-style/shoelace/dist/components/card/card.js'; +import '@shoelace-style/shoelace/dist/components/button/button.js'; + +import { styles } from '../styles/shared-styles'; + +@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 [ + styles, + css` + #welcomeBar { + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + } + + #welcomeCard, + #infoCard { + padding: 18px; + padding-top: 0px; + } + + sl-card::part(footer) { + display: flex; + justify-content: flex-end; + } + + @media(min-width: 750px) { + sl-card { + width: 70vw; + } + } + + + @media (horizontal-viewport-segments: 2) { + #welcomeBar { + flex-direction: row; + align-items: flex-start; + justify-content: space-between; + } + + #welcomeCard { + margin-right: 64px; + } + } + `]; + } + + 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` + + +
+
+ +
+

${this.message}

+
+ +

+ For more information on the PWABuilder pwa-starter, check out the + + Documentation on Github. +

+ +

+ Welcome to the + PWABuilder + pwa-starter! Be sure to head back to + PWABuilder + when you are ready to ship this PWA to the Microsoft Store, Google Play + and the Apple App Store! +

+ + ${'share' in navigator + ? html`Share this Starter!` + : null} +
+ + +

Technology Used

+ + +
+ + Navigate to About +
+
+ `; + } +} -- cgit v1.2.3