@jotyping/jo-designsystem 0.1.1-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierignore +3 -0
- package/.prettierrc +1 -0
- package/.storybook/main.ts +18 -0
- package/.storybook/preview.ts +15 -0
- package/README.md +20 -0
- package/dist/components/button/jd-button.js +42 -0
- package/dist/components/button/jd-button.js.map +1 -0
- package/dist/components/button/jd-button.scss.js +5 -0
- package/dist/components/button/jd-button.scss.js.map +1 -0
- package/dist/components/flash/jd-flash.js +74 -0
- package/dist/components/flash/jd-flash.js.map +1 -0
- package/dist/components/flash/jd-flash.scss.js +5 -0
- package/dist/components/flash/jd-flash.scss.js.map +1 -0
- package/dist/components/footer/jd-footer.js +50 -0
- package/dist/components/footer/jd-footer.js.map +1 -0
- package/dist/components/footer/jd-footer.scss.js +5 -0
- package/dist/components/footer/jd-footer.scss.js.map +1 -0
- package/dist/components/header/jd-header.js +69 -0
- package/dist/components/header/jd-header.js.map +1 -0
- package/dist/components/header/jd-header.scss.js +5 -0
- package/dist/components/header/jd-header.scss.js.map +1 -0
- package/dist/components/heading/jd-heading.js +63 -0
- package/dist/components/heading/jd-heading.js.map +1 -0
- package/dist/components/heading/jd-heading.scss.js +5 -0
- package/dist/components/heading/jd-heading.scss.js.map +1 -0
- package/dist/components/icon/icon-data.js +47 -0
- package/dist/components/icon/icon-data.js.map +1 -0
- package/dist/components/icon/jd-icon.js +58 -0
- package/dist/components/icon/jd-icon.js.map +1 -0
- package/dist/components/icon/jd-icon.scss.js +5 -0
- package/dist/components/icon/jd-icon.scss.js.map +1 -0
- package/dist/components/icon-button/jd-icon-button.js +52 -0
- package/dist/components/icon-button/jd-icon-button.js.map +1 -0
- package/dist/components/icon-button/jd-icon-button.scss.js +5 -0
- package/dist/components/icon-button/jd-icon-button.scss.js.map +1 -0
- package/dist/components/image-link/jd-image-link.js +63 -0
- package/dist/components/image-link/jd-image-link.js.map +1 -0
- package/dist/components/image-link/jd-image-link.scss.js +5 -0
- package/dist/components/image-link/jd-image-link.scss.js.map +1 -0
- package/dist/components/link/jd-link.js +43 -0
- package/dist/components/link/jd-link.js.map +1 -0
- package/dist/components/link/jd-link.scss.js +5 -0
- package/dist/components/link/jd-link.scss.js.map +1 -0
- package/dist/components/modal/jd-modal.js +86 -0
- package/dist/components/modal/jd-modal.js.map +1 -0
- package/dist/components/modal/jd-modal.scss.js +5 -0
- package/dist/components/modal/jd-modal.scss.js.map +1 -0
- package/dist/components/navigation/jd-navigation.js +44 -0
- package/dist/components/navigation/jd-navigation.js.map +1 -0
- package/dist/components/navigation/jd-navigation.scss.js +5 -0
- package/dist/components/navigation/jd-navigation.scss.js.map +1 -0
- package/dist/components/tag/jd-tag.js +36 -0
- package/dist/components/tag/jd-tag.js.map +1 -0
- package/dist/components/tag/jd-tag.scss.js +5 -0
- package/dist/components/tag/jd-tag.scss.js.map +1 -0
- package/dist/fonts/satoshi-black.ttf +0 -0
- package/dist/fonts/satoshi-bold.ttf +0 -0
- package/dist/fonts/satoshi-italic.ttf +0 -0
- package/dist/fonts/satoshi-medium.ttf +0 -0
- package/dist/fonts/satoshi-regular.ttf +0 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/stores/breakpoint-store.js +13 -0
- package/dist/stores/breakpoint-store.js.map +1 -0
- package/dist/vite.svg +1 -0
- package/eslint.config.js +12 -0
- package/index.html +18 -0
- package/license.md +0 -0
- package/package.json +46 -0
- package/public/fonts/satoshi-black.ttf +0 -0
- package/public/fonts/satoshi-bold.ttf +0 -0
- package/public/fonts/satoshi-italic.ttf +0 -0
- package/public/fonts/satoshi-medium.ttf +0 -0
- package/public/fonts/satoshi-regular.ttf +0 -0
- package/public/vite.svg +1 -0
- package/src/assets/lit.svg +1 -0
- package/src/components/button/jd-button.scss +56 -0
- package/src/components/button/jd-button.ts +28 -0
- package/src/components/button/stories/jd-button.stories.ts +44 -0
- package/src/components/flash/jd-flash.scss +47 -0
- package/src/components/flash/jd-flash.ts +65 -0
- package/src/components/flash/stories/jd-flash.stories.ts +62 -0
- package/src/components/footer/jd-footer.scss +42 -0
- package/src/components/footer/jd-footer.ts +42 -0
- package/src/components/footer/stories/jd-footer.stories.ts +20 -0
- package/src/components/header/jd-header.scss +48 -0
- package/src/components/header/jd-header.ts +58 -0
- package/src/components/header/stories/jd-header.stories.ts +52 -0
- package/src/components/heading/jd-heading.scss +48 -0
- package/src/components/heading/jd-heading.ts +49 -0
- package/src/components/heading/stories/jd-heading.stories.ts +47 -0
- package/src/components/icon/icon-data.ts +45 -0
- package/src/components/icon/jd-icon.scss +35 -0
- package/src/components/icon/jd-icon.ts +66 -0
- package/src/components/icon/stories/jd-icon.stories.ts +62 -0
- package/src/components/icon-button/jd-icon-button.scss +36 -0
- package/src/components/icon-button/jd-icon-button.ts +51 -0
- package/src/components/icon-button/stories/jd-icon-button.stories.ts +93 -0
- package/src/components/image-link/jd-image-link.scss +41 -0
- package/src/components/image-link/jd-image-link.ts +36 -0
- package/src/components/image-link/stories/jd-image-link.stories.ts +46 -0
- package/src/components/link/jd-link.scss +29 -0
- package/src/components/link/jd-link.ts +25 -0
- package/src/components/link/stories/jd-link.stories.ts +42 -0
- package/src/components/modal/jd-modal.scss +91 -0
- package/src/components/modal/jd-modal.ts +75 -0
- package/src/components/modal/stories/jd-modal.stories.ts +54 -0
- package/src/components/navigation/jd-navigation.scss +17 -0
- package/src/components/navigation/jd-navigation.ts +32 -0
- package/src/components/navigation/stories/jd-navigation.stories.ts +47 -0
- package/src/components/tag/jd-tag.scss +19 -0
- package/src/components/tag/jd-tag.ts +23 -0
- package/src/components/tag/stories/jd-tag.stories.ts +20 -0
- package/src/components.ts +12 -0
- package/src/index.ts +12 -0
- package/src/stores/breakpoint-store.ts +16 -0
- package/src/styles/_colors.scss +10 -0
- package/src/styles/_fonts.scss +72 -0
- package/src/styles/_mixins.scss +112 -0
- package/src/styles/_reset.scss +62 -0
- package/src/styles/variables.scss +13 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.build.json +12 -0
- package/tsconfig.json +47 -0
- package/vite.config.ts +26 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/web-components-vite";
|
|
2
|
+
import { html } from "lit-html";
|
|
3
|
+
import "../jd-heading";
|
|
4
|
+
|
|
5
|
+
const meta: Meta = {
|
|
6
|
+
title: "Components/Heading",
|
|
7
|
+
component: "jd-heading",
|
|
8
|
+
argTypes: {
|
|
9
|
+
size: {
|
|
10
|
+
control: { type: "select" },
|
|
11
|
+
options: ["l", "m", "s", "auto"],
|
|
12
|
+
description: "Size of the heading",
|
|
13
|
+
defaultValue: "auto",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
type Story = StoryObj;
|
|
20
|
+
|
|
21
|
+
const DefaultExample = ({ ...args }) => {
|
|
22
|
+
return html`<jd-heading size=${args.size}>
|
|
23
|
+
<div slot="title-line-one">Sweat &</div>
|
|
24
|
+
<div slot="title-line-two">coffee</div>
|
|
25
|
+
<div slot="subtitle-bottom">Latest work<br />and crafts</div></jd-heading
|
|
26
|
+
>`;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const DetailExample = ({ ...args }) => {
|
|
30
|
+
return html`<jd-heading size=${args.size}>
|
|
31
|
+
<div slot="title-line-one">Crash</div>
|
|
32
|
+
<div slot="title-line-two">Mate</div>
|
|
33
|
+
<div slot="subtitle-right">iOS App</div></jd-heading
|
|
34
|
+
>`;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const DefaultStory: Story = {
|
|
38
|
+
name: "Default",
|
|
39
|
+
render: DefaultExample.bind({}),
|
|
40
|
+
args: { size: "auto" },
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const DetailStory: Story = {
|
|
44
|
+
name: "Detail",
|
|
45
|
+
render: DetailExample.bind({}),
|
|
46
|
+
args: { ...DefaultStory.args },
|
|
47
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const icons = {
|
|
2
|
+
fire: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1" stroke="currentColor" class="size-6">
|
|
3
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M15.362 5.214A8.252 8.252 0 0 1 12 21 8.25 8.25 0 0 1 6.038 7.047 8.287 8.287 0 0 0 9 9.601a8.983 8.983 0 0 1 3.361-6.867 8.21 8.21 0 0 0 3 2.48Z" />
|
|
4
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M12 18a3.75 3.75 0 0 0 .495-7.468 5.99 5.99 0 0 0-1.925 3.547 5.975 5.975 0 0 1-2.133-1.001A3.75 3.75 0 0 0 12 18Z" />
|
|
5
|
+
</svg>`,
|
|
6
|
+
lightning: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1" stroke="currentColor" class="size-6">
|
|
7
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="m3.75 13.5 10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75Z" />
|
|
8
|
+
</svg>
|
|
9
|
+
`,
|
|
10
|
+
chat: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1" stroke="currentColor" class="size-6">
|
|
11
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M8.625 12a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm0 0H8.25m4.125 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm0 0H12m4.125 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm0 0h-.375M21 12c0 4.556-4.03 8.25-9 8.25a9.764 9.764 0 0 1-2.555-.337A5.972 5.972 0 0 1 5.41 20.97a5.969 5.969 0 0 1-.474-.065 4.48 4.48 0 0 0 .978-2.025c.09-.457-.133-.901-.467-1.226C3.93 16.178 3 14.189 3 12c0-4.556 4.03-8.25 9-8.25s9 3.694 9 8.25Z" />
|
|
12
|
+
</svg>
|
|
13
|
+
`,
|
|
14
|
+
puzzle: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1" stroke="currentColor" class="size-6">
|
|
15
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z" />
|
|
16
|
+
</svg>
|
|
17
|
+
`,
|
|
18
|
+
"arrow-circle-left": `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1" stroke="currentColor" class="size-6">
|
|
19
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="m11.25 9-3 3m0 0 3 3m-3-3h7.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
|
|
20
|
+
</svg>
|
|
21
|
+
`,
|
|
22
|
+
"arrow-right": `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1" stroke="currentColor" class="size-6">
|
|
23
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3" />
|
|
24
|
+
</svg>
|
|
25
|
+
`,
|
|
26
|
+
"burger-menu": `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.6" stroke="currentColor" class="size-6">
|
|
27
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M6 8h12M6 16h12" />
|
|
28
|
+
</svg>
|
|
29
|
+
`,
|
|
30
|
+
x: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
|
|
31
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12" />
|
|
32
|
+
</svg>
|
|
33
|
+
`,
|
|
34
|
+
circle: `<svg
|
|
35
|
+
width="8"
|
|
36
|
+
height="8"
|
|
37
|
+
viewBox="0 0 8 8"
|
|
38
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
39
|
+
>
|
|
40
|
+
<circle cx="4" cy="4" r="4" fill="currentColor" />
|
|
41
|
+
</svg>
|
|
42
|
+
`,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { icons };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@use "/src/styles/colors.scss" as colors;
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
display: inline-block;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.icon-wrapper {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
&.blue {
|
|
12
|
+
color: colors.$color-accent-blue;
|
|
13
|
+
}
|
|
14
|
+
&.red {
|
|
15
|
+
color: colors.$color-accent-red;
|
|
16
|
+
}
|
|
17
|
+
&.purple {
|
|
18
|
+
color: colors.$color-accent-purple;
|
|
19
|
+
}
|
|
20
|
+
&.black {
|
|
21
|
+
color: colors.$color-black;
|
|
22
|
+
}
|
|
23
|
+
&.white {
|
|
24
|
+
color: colors.$color-white;
|
|
25
|
+
}
|
|
26
|
+
&.neutral-200 {
|
|
27
|
+
color: colors.$color-neutral-200;
|
|
28
|
+
}
|
|
29
|
+
&.neutral-400 {
|
|
30
|
+
color: colors.$color-neutral-400;
|
|
31
|
+
}
|
|
32
|
+
&.neutral-600 {
|
|
33
|
+
color: colors.$color-neutral-600;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { LitElement, html, unsafeCSS } from "lit";
|
|
2
|
+
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
import { icons } from "./icon-data.ts";
|
|
4
|
+
import style from "./jd-icon.scss?inline";
|
|
5
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
6
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
7
|
+
import "../../components";
|
|
8
|
+
|
|
9
|
+
export type IconName =
|
|
10
|
+
| "circle"
|
|
11
|
+
| "x"
|
|
12
|
+
| "fire"
|
|
13
|
+
| "puzzle"
|
|
14
|
+
| "lightning"
|
|
15
|
+
| "arrow-right"
|
|
16
|
+
| "arrow-circle-left"
|
|
17
|
+
| "burger-menu"
|
|
18
|
+
| "chat";
|
|
19
|
+
|
|
20
|
+
@customElement("jd-icon")
|
|
21
|
+
export class JdIcon extends LitElement {
|
|
22
|
+
static styles = unsafeCSS(style);
|
|
23
|
+
|
|
24
|
+
@property({ type: String }) iconName: IconName = "fire";
|
|
25
|
+
|
|
26
|
+
@property({ type: String }) size:
|
|
27
|
+
| "72px"
|
|
28
|
+
| "56px"
|
|
29
|
+
| "48px"
|
|
30
|
+
| "40px"
|
|
31
|
+
| "32px"
|
|
32
|
+
| "24px"
|
|
33
|
+
| "16px" = "48px";
|
|
34
|
+
|
|
35
|
+
@property({ type: String }) color:
|
|
36
|
+
| "red"
|
|
37
|
+
| "purple"
|
|
38
|
+
| "blue"
|
|
39
|
+
| "black"
|
|
40
|
+
| "white"
|
|
41
|
+
| "neutral-200"
|
|
42
|
+
| "neutral-400"
|
|
43
|
+
| "neutral-600" = "black";
|
|
44
|
+
|
|
45
|
+
render() {
|
|
46
|
+
const iconWrapperClasses = {
|
|
47
|
+
"icon-wrapper": true,
|
|
48
|
+
[this.color]: true,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return html`
|
|
52
|
+
<div
|
|
53
|
+
class=${classMap(iconWrapperClasses)}
|
|
54
|
+
style="height: ${this.size}; width: ${this.size};"
|
|
55
|
+
>
|
|
56
|
+
${unsafeHTML(icons[this.iconName])}
|
|
57
|
+
</div>
|
|
58
|
+
`;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
declare global {
|
|
63
|
+
interface HTMLElementTagNameMap {
|
|
64
|
+
"jd-icon": JdIcon;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/web-components-vite";
|
|
2
|
+
import { html } from "lit-html";
|
|
3
|
+
import "../jd-icon";
|
|
4
|
+
|
|
5
|
+
const meta: Meta = {
|
|
6
|
+
title: "Components/Icon",
|
|
7
|
+
component: "jd-icon",
|
|
8
|
+
argTypes: {
|
|
9
|
+
size: {
|
|
10
|
+
control: { type: "select" },
|
|
11
|
+
options: ["72px", "56px", "48px", "32px", "24px", "16px"],
|
|
12
|
+
description: "Size of icon",
|
|
13
|
+
defaultValue: "48px",
|
|
14
|
+
},
|
|
15
|
+
color: {
|
|
16
|
+
control: { type: "select" },
|
|
17
|
+
options: [
|
|
18
|
+
"red",
|
|
19
|
+
"purple",
|
|
20
|
+
"blue",
|
|
21
|
+
"black",
|
|
22
|
+
"white",
|
|
23
|
+
"neutral-200",
|
|
24
|
+
"neutral-400",
|
|
25
|
+
"neutral-600",
|
|
26
|
+
],
|
|
27
|
+
description: "Color of the icon",
|
|
28
|
+
defaultValue: "red",
|
|
29
|
+
},
|
|
30
|
+
iconName: {
|
|
31
|
+
control: { type: "select" },
|
|
32
|
+
options: [
|
|
33
|
+
"fire",
|
|
34
|
+
"lightning",
|
|
35
|
+
"arrow-right",
|
|
36
|
+
"arrow-circle-left",
|
|
37
|
+
"burger-menu",
|
|
38
|
+
"puzzle",
|
|
39
|
+
"chat",
|
|
40
|
+
],
|
|
41
|
+
description: "Icon name",
|
|
42
|
+
defaultValue: "puzzle",
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default meta;
|
|
48
|
+
type Story = StoryObj;
|
|
49
|
+
|
|
50
|
+
const DefaultExample = ({ ...args }) => {
|
|
51
|
+
return html`<jd-icon
|
|
52
|
+
iconName=${args.iconName}
|
|
53
|
+
color=${args.color}
|
|
54
|
+
size=${args.size}
|
|
55
|
+
></jd-icon>`;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const DefaultStory: Story = {
|
|
59
|
+
name: "Default",
|
|
60
|
+
render: DefaultExample.bind({}),
|
|
61
|
+
args: { iconName: "puzzle", color: "blue", size: "48px" },
|
|
62
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
@use "/src/styles/mixins.scss" as mixins;
|
|
2
|
+
@use "/src/styles/colors.scss" as colors;
|
|
3
|
+
|
|
4
|
+
:host {
|
|
5
|
+
display: inline-block;
|
|
6
|
+
height: 48px;
|
|
7
|
+
width: 48px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
:host([active]) button {
|
|
11
|
+
&.borderless {
|
|
12
|
+
color: colors.$color-black;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
button {
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
border: none;
|
|
19
|
+
padding: 0;
|
|
20
|
+
width: 48px;
|
|
21
|
+
height: 48px;
|
|
22
|
+
&.borderless {
|
|
23
|
+
color: colors.$color-black;
|
|
24
|
+
background-color: colors.$color-white;
|
|
25
|
+
&:hover {
|
|
26
|
+
color: colors.$color-accent-red;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
&.border {
|
|
30
|
+
color: #3a3a3a;
|
|
31
|
+
background-color: colors.$color-white;
|
|
32
|
+
outline: 2px solid colors.$color-black;
|
|
33
|
+
outline-offset: -2px;
|
|
34
|
+
border-radius: 24px;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { LitElement, html, unsafeCSS } from "lit";
|
|
2
|
+
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
import style from "./jd-icon-button.scss?inline";
|
|
4
|
+
import { IconName } from "../icon/jd-icon.ts";
|
|
5
|
+
import "../../components";
|
|
6
|
+
|
|
7
|
+
@customElement("jd-icon-button")
|
|
8
|
+
export class JdIconButton extends LitElement {
|
|
9
|
+
static styles = unsafeCSS(style);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Button type, can be "primary" or "secondary".
|
|
13
|
+
*/
|
|
14
|
+
@property({ type: String }) type: "borderless" | "border" = "borderless";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Icon name.
|
|
18
|
+
*/
|
|
19
|
+
@property({ type: String }) iconName: IconName = "puzzle";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Icon color.
|
|
23
|
+
*/
|
|
24
|
+
@property({ type: String }) color:
|
|
25
|
+
| "red"
|
|
26
|
+
| "purple"
|
|
27
|
+
| "blue"
|
|
28
|
+
| "black"
|
|
29
|
+
| "white"
|
|
30
|
+
| "neutral-200"
|
|
31
|
+
| "neutral-400"
|
|
32
|
+
| "neutral-600" = "black";
|
|
33
|
+
|
|
34
|
+
render() {
|
|
35
|
+
return html`
|
|
36
|
+
<button class=${this.type}>
|
|
37
|
+
<jd-icon
|
|
38
|
+
iconName=${this.iconName}
|
|
39
|
+
color=${this.color}
|
|
40
|
+
size=${this.type === "borderless" ? "48px" : "32px"}
|
|
41
|
+
></jd-icon>
|
|
42
|
+
</button>
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare global {
|
|
48
|
+
interface HTMLElementTagNameMap {
|
|
49
|
+
"jd-icon-button": JdIconButton;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/web-components-vite";
|
|
2
|
+
import { html } from "lit-html";
|
|
3
|
+
import { IconName } from "../../icon/jd-icon.ts";
|
|
4
|
+
import "../jd-icon-button.ts";
|
|
5
|
+
|
|
6
|
+
type JdIconButtonArgs = {
|
|
7
|
+
type: "borderless" | "border";
|
|
8
|
+
iconName: IconName;
|
|
9
|
+
color:
|
|
10
|
+
| "red"
|
|
11
|
+
| "purple"
|
|
12
|
+
| "blue"
|
|
13
|
+
| "black"
|
|
14
|
+
| "white"
|
|
15
|
+
| "neutral-200"
|
|
16
|
+
| "neutral-400"
|
|
17
|
+
| "neutral-600";
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const meta: Meta<JdIconButtonArgs> = {
|
|
21
|
+
title: "Components/IconButton",
|
|
22
|
+
component: "jd-icon-button",
|
|
23
|
+
argTypes: {
|
|
24
|
+
type: {
|
|
25
|
+
control: { type: "select" },
|
|
26
|
+
options: ["borderless", "border"],
|
|
27
|
+
description: "Type of the button",
|
|
28
|
+
defaultValue: "borderless",
|
|
29
|
+
},
|
|
30
|
+
iconName: {
|
|
31
|
+
control: { type: "select" },
|
|
32
|
+
options: [
|
|
33
|
+
"x",
|
|
34
|
+
"puzzle",
|
|
35
|
+
"home",
|
|
36
|
+
"settings",
|
|
37
|
+
"user",
|
|
38
|
+
"search",
|
|
39
|
+
"notification",
|
|
40
|
+
"message",
|
|
41
|
+
"help",
|
|
42
|
+
"logout",
|
|
43
|
+
],
|
|
44
|
+
description: "Name of the icon",
|
|
45
|
+
defaultValue: "puzzle",
|
|
46
|
+
},
|
|
47
|
+
color: {
|
|
48
|
+
control: { type: "select" },
|
|
49
|
+
options: [
|
|
50
|
+
"red",
|
|
51
|
+
"purple",
|
|
52
|
+
"blue",
|
|
53
|
+
"black",
|
|
54
|
+
"white",
|
|
55
|
+
"neutral-200",
|
|
56
|
+
"neutral-400",
|
|
57
|
+
"neutral-600",
|
|
58
|
+
],
|
|
59
|
+
description: "Color of the icon",
|
|
60
|
+
defaultValue: "black",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default meta;
|
|
66
|
+
type Story = StoryObj<JdIconButtonArgs>;
|
|
67
|
+
|
|
68
|
+
const DefaultExample = (args: JdIconButtonArgs) => {
|
|
69
|
+
const onClick = () => {
|
|
70
|
+
console.log("Button clicked!");
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
return html`
|
|
74
|
+
<jd-icon-button
|
|
75
|
+
type=${args.type}
|
|
76
|
+
color=${args.color}
|
|
77
|
+
icon-name=${args.iconName}
|
|
78
|
+
@click=${onClick}
|
|
79
|
+
></jd-icon-button>
|
|
80
|
+
`;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const DefaultStory: Story = {
|
|
84
|
+
name: "Default",
|
|
85
|
+
render: DefaultExample.bind({}),
|
|
86
|
+
args: { type: "borderless", iconName: "puzzle", color: "black" },
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const SecondaryStory: Story = {
|
|
90
|
+
name: "Border",
|
|
91
|
+
render: DefaultExample.bind({}),
|
|
92
|
+
args: { ...DefaultStory.args, type: "border" },
|
|
93
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
@use "/src/styles/mixins.scss" as mixins;
|
|
2
|
+
@use "/src/styles/colors.scss" as colors;
|
|
3
|
+
|
|
4
|
+
:host {
|
|
5
|
+
display: inline-block;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.link-wrapper {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
gap: 4px;
|
|
12
|
+
width: auto;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
a {
|
|
16
|
+
color: colors.$color-black;
|
|
17
|
+
text-decoration: none;
|
|
18
|
+
background-color: transparent;
|
|
19
|
+
&:hover {
|
|
20
|
+
color: colors.$color-black;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.title {
|
|
25
|
+
&.l {
|
|
26
|
+
@include mixins.font-01-copy-italic;
|
|
27
|
+
}
|
|
28
|
+
&.m,
|
|
29
|
+
&.s {
|
|
30
|
+
@include mixins.font-02-copy-italic;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.divider {
|
|
35
|
+
border-bottom: solid 2px colors.$color-black;
|
|
36
|
+
height: 1px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.description {
|
|
40
|
+
@include mixins.font-03-copy;
|
|
41
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { LitElement, html, unsafeCSS } from "lit";
|
|
2
|
+
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
import style from "./jd-image-link.scss?inline";
|
|
4
|
+
import { SignalWatcher } from "@lit-labs/signals";
|
|
5
|
+
import { breakpoint } from "../../stores/breakpoint-store";
|
|
6
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
7
|
+
import "../../components";
|
|
8
|
+
|
|
9
|
+
@customElement("jd-image-link")
|
|
10
|
+
export class JdImageLink extends SignalWatcher(LitElement) {
|
|
11
|
+
static styles = unsafeCSS(style);
|
|
12
|
+
@property({ type: String }) href = "";
|
|
13
|
+
@property({ type: String }) target: "_blank" | "_bla" = "_blank";
|
|
14
|
+
@property({ type: String }) description = "";
|
|
15
|
+
|
|
16
|
+
render() {
|
|
17
|
+
const titleClass = {
|
|
18
|
+
title: true,
|
|
19
|
+
[breakpoint.get()]: true,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return html`
|
|
23
|
+
<div>
|
|
24
|
+
<a href="${this.href}" target="${this.target}">
|
|
25
|
+
<div class="link-wrapper">
|
|
26
|
+
<div class=${classMap(titleClass)}>
|
|
27
|
+
<slot></slot>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="divider"></div>
|
|
30
|
+
<div class="description">${this.description}</div>
|
|
31
|
+
</div>
|
|
32
|
+
</a>
|
|
33
|
+
</div>
|
|
34
|
+
`;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/web-components-vite";
|
|
2
|
+
import { html } from "lit-html";
|
|
3
|
+
import "../jd-image-link.ts";
|
|
4
|
+
|
|
5
|
+
type JdImageLinkArgs = {
|
|
6
|
+
href: string;
|
|
7
|
+
target: "_blank" | "_bla";
|
|
8
|
+
description: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const meta: Meta<JdImageLinkArgs> = {
|
|
12
|
+
title: "Components/ImageLink",
|
|
13
|
+
component: "jd-image-link",
|
|
14
|
+
argTypes: {
|
|
15
|
+
href: {
|
|
16
|
+
control: { type: "text" },
|
|
17
|
+
description: "href of the link",
|
|
18
|
+
defaultValue: "",
|
|
19
|
+
},
|
|
20
|
+
target: {
|
|
21
|
+
control: { type: "select" },
|
|
22
|
+
options: ["_blank", "_bla"],
|
|
23
|
+
description: "href of the link",
|
|
24
|
+
defaultValue: "",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default meta;
|
|
30
|
+
type Story = StoryObj<JdImageLinkArgs>;
|
|
31
|
+
|
|
32
|
+
const DefaultExample = (args: JdImageLinkArgs) => {
|
|
33
|
+
return html` <jd-image-link
|
|
34
|
+
href=${args.href}
|
|
35
|
+
target=${args.target}
|
|
36
|
+
description="This is a link"
|
|
37
|
+
>
|
|
38
|
+
Click me
|
|
39
|
+
</jd-image-link>`;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const DefaultStory: Story = {
|
|
43
|
+
name: "Default",
|
|
44
|
+
render: DefaultExample.bind({}),
|
|
45
|
+
args: { href: "https://www.google.com", target: "_blank" },
|
|
46
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
@use "/src/styles/mixins.scss" as mixins;
|
|
2
|
+
@use "/src/styles/colors.scss" as colors;
|
|
3
|
+
|
|
4
|
+
:host {
|
|
5
|
+
display: inline-block;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.link-wrapper {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
gap: 4px;
|
|
12
|
+
width: auto;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
a {
|
|
16
|
+
color: colors.$color-black;
|
|
17
|
+
text-decoration: none;
|
|
18
|
+
background-color: transparent;
|
|
19
|
+
&:hover {
|
|
20
|
+
color: colors.$color-black;
|
|
21
|
+
text-decoration: underline;
|
|
22
|
+
text-decoration-thickness: 2px;
|
|
23
|
+
text-underline-offset: 6px;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.title {
|
|
28
|
+
@include mixins.font-03-copy;
|
|
29
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LitElement, html, unsafeCSS } from "lit";
|
|
2
|
+
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
import style from "./jd-link.scss?inline";
|
|
4
|
+
|
|
5
|
+
@customElement("jd-link")
|
|
6
|
+
export class JdLink extends LitElement {
|
|
7
|
+
static styles = unsafeCSS(style);
|
|
8
|
+
@property({ type: String }) href = "";
|
|
9
|
+
@property({ type: String }) target: "_blank" | "_bla" = "_blank";
|
|
10
|
+
@property({ type: String }) description = "";
|
|
11
|
+
|
|
12
|
+
render() {
|
|
13
|
+
return html`
|
|
14
|
+
<div>
|
|
15
|
+
<a href="${this.href}" target="${this.target}">
|
|
16
|
+
<div class="link-wrapper">
|
|
17
|
+
<div class="title">
|
|
18
|
+
<slot></slot>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</a>
|
|
22
|
+
</div>
|
|
23
|
+
`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/web-components-vite";
|
|
2
|
+
import { html } from "lit-html";
|
|
3
|
+
import "../jd-link.ts";
|
|
4
|
+
|
|
5
|
+
type JdLinkArgs = {
|
|
6
|
+
href: string;
|
|
7
|
+
target: "_blank" | "_bla";
|
|
8
|
+
description: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const meta: Meta<JdLinkArgs> = {
|
|
12
|
+
title: "Components/Link",
|
|
13
|
+
component: "jd-link",
|
|
14
|
+
argTypes: {
|
|
15
|
+
href: {
|
|
16
|
+
control: { type: "text" },
|
|
17
|
+
description: "href of the link",
|
|
18
|
+
defaultValue: "",
|
|
19
|
+
},
|
|
20
|
+
target: {
|
|
21
|
+
control: { type: "select" },
|
|
22
|
+
options: ["_blank", "_bla"],
|
|
23
|
+
description: "href of the link",
|
|
24
|
+
defaultValue: "",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default meta;
|
|
30
|
+
type Story = StoryObj<JdLinkArgs>;
|
|
31
|
+
|
|
32
|
+
const DefaultExample = (args: JdLinkArgs) => {
|
|
33
|
+
return html` <jd-link href=${args.href} target=${args.target}>
|
|
34
|
+
Click me
|
|
35
|
+
</jd-link>`;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const DefaultStory: Story = {
|
|
39
|
+
name: "Default",
|
|
40
|
+
render: DefaultExample.bind({}),
|
|
41
|
+
args: { href: "https://www.google.com", target: "_blank" },
|
|
42
|
+
};
|