Skip to content

Commit

Permalink
feat: logo component
Browse files Browse the repository at this point in the history
  • Loading branch information
DanWebb committed Jan 24, 2024
1 parent 14ba3b6 commit cc7898b
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 5 deletions.
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
Expand Up @@ -3,6 +3,9 @@ import { defineConfig } from 'vite';

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

0 comments on commit cc7898b

Please sign in to comment.