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

Logo component #2

Merged
merged 1 commit into from
Jan 24, 2024
Merged
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
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/src/style.css" />
<title>Recycling Locator widget</title>
Expand Down
Binary file added public/recycling-locator-logo.webp
Binary file not shown.
1 change: 0 additions & 1 deletion public/vite.svg

This file was deleted.

2 changes: 1 addition & 1 deletion src/app/Start.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export default function StartPage() {
return (
<locator-layout>
<header slot="header">
<locator-logo>Recycling Locator</locator-logo>
<locator-logo></locator-logo>
</header>
<div slot="main">
<h2>Find places to recycle</h2>
Expand Down
3 changes: 1 addition & 2 deletions src/components/Layout/Layout.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ const meta: Meta = {
};

export default meta;
type Story = StoryObj;

export const Layout: Story = {
export const Layout: StoryObj = {
render: () => html`
<locator-layout>
<header slot="header">Header</header>
Expand Down
14 changes: 14 additions & 0 deletions src/components/Logo/Logo.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Meta, StoryObj } from '@storybook/web-components';
import { html } from 'lit';

import './Logo';

const meta: Meta = {
component: 'locator-logo',
};

export default meta;

export const Logo: StoryObj = {
render: () => html`<locator-logo></locator-logo>`,
};
28 changes: 28 additions & 0 deletions src/components/Logo/Logo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { LitElement, css, html } from 'lit';
import { customElement } from 'lit/decorators.js';

@customElement('locator-logo')
export class Logo extends LitElement {
static styles = css`
:host {
display: block;
}

img {
display: block;
width: min(230px, 100%);
height: auto;
}
`;

render() {
return html`
<img
src="/recycling-locator-logo.webp"
alt="Recycling Locator"
width="230"
height="42"
/>
`;
}
}
3 changes: 3 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import preact from '@preact/preset-vite';

Check warning on line 1 in vite.config.ts

View workflow job for this annotation

GitHub Actions / lint

Using exported name 'preact' as identifier for default export
import { defineConfig } from 'vite';

// https://vitejs.dev/config/
export default defineConfig({
server: {
port: 3000,
},
plugins: [
preact({
babel: {
Expand Down
Loading