Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkpoint - style & component. next: cycling #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
- uses: actions/setup-node@v4

- name: Install dependencies
run: yarn install
run: npm install

- name: Run tests
run: yarn run test
run: npm run test

- name: Upload reports
run: npx codecov
4 changes: 2 additions & 2 deletions .github/workflows/gh-pages-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
- uses: actions/setup-node@v4

- name: Install dependencies
run: yarn install
run: npm install

- name: Create build files for gh-pages deploy
run: yarn ghpages:build
run: npm run ghpages:build

# Reference: https://github.com/JamesIves/github-pages-deploy-action
- name: Deploy 🚀
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:

- name: Install and Build
run: |
yarn install
yarn ghpages:build
npm install
npm run ghpages:build

# Reference: https://github.com/rossjrw/pr-preview-action
- name: Deploy preview
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ storybook-static
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
npm-debug.log*
npm-error.log*
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,47 +18,47 @@ This is a base template for creating Typescript WebComponents. It is based off o

## Local Demo with `web-dev-server`
```bash
yarn start
npm start
```
To run a local development server that serves the basic demo located in `demo/index.html`

## Testing with Web Test Runner
To run the suite of Web Test Runner tests, run
```bash
yarn run test
npm run test
```

To run the tests in watch mode (for <abbr title="test driven development">TDD</abbr>, for example), run

```bash
yarn run test:watch
npm run test:watch
```

## Linting with ESLint, Prettier, and Types
To scan the project for linting errors, run
```bash
yarn run lint
npm run lint
```

You can lint with ESLint and Prettier individually as well
```bash
yarn run lint:eslint
npm run lint:eslint
```
```bash
yarn run lint:prettier
npm run lint:prettier
```

To automatically fix many linting errors, run
```bash
yarn run format
npm run format
```

You can format using ESLint and Prettier individually as well
```bash
yarn run format:eslint
npm run format:eslint
```
```bash
yarn run format:prettier
npm run format:prettier
```

## Tooling configs
Expand Down Expand Up @@ -100,7 +100,7 @@ git push origin gh-pages

You can update the current Github Page without pushing a commit by running:
```
yarn run ghpages:publish
npm run ghpages:publish
```

This build script does the following, see `package.json`:
Expand Down
77 changes: 73 additions & 4 deletions demo/app-root.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,89 @@
import { html, css, LitElement } from 'lit';
import { customElement } from 'lit/decorators.js';
import '../src/your-webcomponent';
import '../src/iaux-notification-toast';
import type {
aNotification,
IauxNotificationToast,
} from '../src/iaux-notification-toast';

@customElement('app-root')
export class AppRoot extends LitElement {
successNotif(message?: string): aNotification {
return {
message: message ?? 'Default success message',
status: 'success',
};
}

errorNotif(message?: string): aNotification {
return {
message: message ?? 'Default error message',
status: 'fail',
};
}

render() {
return html`
<your-webcomponent title="Hello">
<div slot="my-slot">Some slotted content</div>
</your-webcomponent>
<section id="demo-controls">
<button
@click="${() => {
const toast = this.shadowRoot!.querySelector(
'iaux-notification-toast'
) as IauxNotificationToast;
toast.addNotification(this.successNotif());
}}"
>
Add Success Notification
</button>
<button
@click="${() => {
const toast = this.shadowRoot!.querySelector(
'iaux-notification-toast'
) as IauxNotificationToast;
toast.addNotification(this.errorNotif());
}}"
>
Add Error Notification
</button>
<button
@click="${() => {
const toast = this.shadowRoot!.querySelector(
'iaux-notification-toast'
) as IauxNotificationToast;
const notif =
Math.random() > 0.5
? this.successNotif('Randomized notif success')
: this.errorNotif('Randomized notif error');
toast.addNotification(notif);
}}"
>
Add Random Notification
</button>
<button
@click="${() => {
const toast = this.shadowRoot!.querySelector(
'iaux-notification-toast'
) as IauxNotificationToast;
toast.clear();
}}"
>
Clear Notifications
</button>
</section>
<iaux-notification-toast title="Hello"> </iaux-notification-toast>
`;
}

static styles = css`
:host {
display: block;
}
section#demo-controls {
background-color: aliceblue;
width: 100%;
min-height: 50px;
display: flex;
padding-bottom: 50px;
}
`;
}
3 changes: 2 additions & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<meta charset="utf-8">
<style>
html {
font-size: 10px; /* This is to match petabox's base font size */
font-size: 14px; /* This is to match petabox's base font size */
font-family: Arial, Helvetica, sans-serif;
}

body {
Expand Down
Loading
Loading