-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add skeleton for inboxitems with example story in storybook …
…(WIP)
- Loading branch information
Sean Scully
committed
Feb 7, 2024
1 parent
7d1f05b
commit b6259dc
Showing
10 changed files
with
130 additions
and
4 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
packages/frontend-design-poc/src/components/InboxItem/InboxItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import styles from "./inboxItem.module.css"; | ||
|
||
interface Participant { | ||
label: string; | ||
icon?: JSX.Element; | ||
} | ||
|
||
interface InboxItemTag { | ||
label: string; | ||
icon?: JSX.Element; | ||
className?: string; | ||
} | ||
|
||
interface InboxItemProps { | ||
title: string; | ||
toLabel: string; | ||
description: string; | ||
sender: Participant; | ||
receiver: Participant; | ||
tags?: InboxItemTag[]; | ||
} | ||
|
||
export const InboxItem = ({ | ||
title, | ||
description, | ||
sender, | ||
receiver, | ||
toLabel, | ||
tags, | ||
}: InboxItemProps) => { | ||
return ( | ||
<div className={styles.inboxItem}> | ||
<div>{title}</div> | ||
<div>{description}</div> | ||
<div className="participants"> | ||
<div> | ||
<div>{sender.icon}</div> | ||
<div>{sender.label}</div> | ||
</div> | ||
<span>{toLabel}</span> | ||
<div> | ||
<div>{receiver.icon}</div> | ||
<div>{receiver.label}</div> | ||
</div> | ||
</div> | ||
<div> | ||
{tags?.map((tag) => ( | ||
<div> | ||
{tag.icon} | ||
{tag.label} | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
}; |
4 changes: 4 additions & 0 deletions
4
packages/frontend-design-poc/src/components/InboxItem/inboxItem.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.inboxItem { | ||
display: flex; | ||
flex-direction: column; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { InboxItem } from "./InboxItem.tsx"; |
9 changes: 9 additions & 0 deletions
9
packages/frontend-design-poc/src/components/InboxItems/InboxItems.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import styles from "./inboxItems.module.css"; | ||
|
||
interface InboxItemsProps { | ||
children: React.ReactNode; | ||
} | ||
|
||
export const InboxItems = ({ children }: InboxItemsProps) => { | ||
return <div className={styles.inboxItems}>{children}</div>; | ||
}; |
5 changes: 5 additions & 0 deletions
5
packages/frontend-design-poc/src/components/InboxItems/inboxItems.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.inboxItems { | ||
display: flex; | ||
flex-direction: column; | ||
row-gap: 2em; | ||
} |
1 change: 1 addition & 0 deletions
1
packages/frontend-design-poc/src/components/InboxItems/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { InboxItems } from "./InboxItems.tsx"; |
2 changes: 1 addition & 1 deletion
2
...s/storybook/src/stories/Button.stories.ts → ...book/src/stories/Button/Button.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
50 changes: 50 additions & 0 deletions
50
packages/storybook/src/stories/InboxItems/InboxItems.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import { InboxItems } from "../../../../frontend-design-poc/src/components/InboxItems"; | ||
import { InboxItem } from "../../../../frontend-design-poc/src/components/InboxItem"; | ||
|
||
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export | ||
const meta = { | ||
title: "Example/InboxItem", | ||
component: InboxItems, | ||
parameters: { | ||
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout | ||
layout: "centered", | ||
}, // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs | ||
tags: ["autodocs"], // More on argTypes: https://storybook.js.org/docs/api/argtypes | ||
} satisfies Meta<typeof InboxItems>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args | ||
export const simpleExample: Story = { | ||
args: { | ||
children: [ | ||
<InboxItem | ||
title="Tittel" | ||
description="Beskrivelse" | ||
sender={{ | ||
label: "Avsender", | ||
}} | ||
receiver={{ | ||
label: "Mottaker", | ||
}} | ||
toLabel="til" | ||
tags={[{ label: "hello" }, { label: "hallaz" }]} | ||
/>, | ||
<InboxItem | ||
title="Tittel" | ||
description="Beskrivelse" | ||
sender={{ | ||
label: "Avsender", | ||
}} | ||
receiver={{ | ||
label: "Mottaker", | ||
}} | ||
toLabel="til" | ||
tags={[{ label: "hello" }, { label: "hallaz" }]} | ||
/>, | ||
], | ||
}, | ||
}; |