-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from AlecsMissangu/telfe-228-user-profile
TELFE 228: User profile
- Loading branch information
Showing
20 changed files
with
887 additions
and
2,493 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -32,3 +32,5 @@ upload.env | |
main.tsx | ||
App.tsx | ||
.idea | ||
|
||
*storybook.log |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,38 +1,17 @@ | ||
import type { StorybookConfig } from "@storybook/react-vite"; | ||
import remarkGfm from "remark-gfm"; | ||
|
||
const stories = [ | ||
"../src/**/*.stories.mdx", | ||
"../src/**/*.stories.@(js|jsx|ts|tsx)", | ||
]; | ||
const addons = [ | ||
"@storybook/addon-links", | ||
"@storybook/addon-essentials", | ||
"@storybook/addon-a11y", | ||
"storybook-addon-themes", | ||
// "storybook-dark-mode", | ||
{ | ||
name: "@storybook/addon-docs", | ||
options: { | ||
mdxPluginOptions: { | ||
mdxCompileOptions: { | ||
remarkPlugins: [remarkGfm], | ||
}, | ||
}, | ||
}, | ||
}, | ||
]; | ||
const features = { | ||
storyStoreV7: true, | ||
}; | ||
const docs = { | ||
autodocs: true, | ||
}; | ||
const config: StorybookConfig = { | ||
stories, | ||
addons, | ||
docs, | ||
features, | ||
framework: "@storybook/react-vite", | ||
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], | ||
addons: [ | ||
"@storybook/addon-onboarding", | ||
"@storybook/addon-links", | ||
"@storybook/addon-essentials", | ||
"@chromatic-com/storybook", | ||
"@storybook/addon-interactions", | ||
], | ||
framework: { | ||
name: "@storybook/react-vite", | ||
options: {}, | ||
}, | ||
}; | ||
export default config; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,41 +1,23 @@ | ||
import { Parameters, Preview } from "@storybook/react"; | ||
import { themes } from "@storybook/theming"; | ||
import React from "react"; | ||
import TeliStyledEngineProvider from "../src/providers/TeliStyledEngineProvider/TeliStyledEngineProvider"; | ||
import { DocsContainer } from "./DocsContainer"; | ||
import ThemeWrapper from "./ThemeWrapper"; | ||
import "../src/main.css"; | ||
import "../src/assets/fonts/fontawesome/css/all.min.css"; | ||
import type { Preview } from "@storybook/react"; | ||
import UIThemeProvider from "../src/v1/theme/UIThemeProvider"; | ||
|
||
const decorators = [ | ||
(Story) => <TeliStyledEngineProvider>{Story()}</TeliStyledEngineProvider>, | ||
(Story) => <ThemeWrapper>{Story()}</ThemeWrapper>, | ||
]; | ||
|
||
const parameters: Parameters = { | ||
actions: { argTypesRegex: "^on[A-Z].*" }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, // Doesn't work. I think its a bug in storybook 7 - Alecs | ||
date: /Date$/, | ||
const preview: Preview = { | ||
decorators: [ | ||
(Story) => ( | ||
<UIThemeProvider theme="DataNavy"> | ||
<Story /> | ||
</UIThemeProvider> | ||
), | ||
], | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
}, | ||
darkMode: { | ||
classTarget: "html", | ||
stylePreview: true, | ||
dark: { ...themes.dark, appBg: "#1D1D1D", appContentBg: "#1D1D1D" }, | ||
light: { ...themes.light, appBg: "#F2F2F2", appContentBg: "#F2F2F2" }, | ||
}, | ||
a11y: { | ||
element: "#storybook-root", | ||
manual: false, | ||
}, | ||
docs: { container: DocsContainer }, | ||
}; | ||
|
||
const preview: Preview = { | ||
decorators, | ||
parameters, | ||
}; | ||
|
||
export default preview; |
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.
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.
File renamed without changes.
File renamed without changes.
38 changes: 38 additions & 0 deletions
38
src/v1/components/data-display/UserProfile/UserProfile.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,38 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import UserProfile from "./UserProfile"; | ||
import FlexBox from "../../layout/FlexBox"; | ||
import { Text } from "../Text/Text"; | ||
import * as UserProfileContentStories from "./UserProfileContent/UserProfileContent.stories"; | ||
import UserProfileContent from "./UserProfileContent/UserProfileContent"; | ||
|
||
const meta = { | ||
component: UserProfile, | ||
tags: ["autodocs"], | ||
// subcomponents: { UserProfileContent }, // doesn't work yet -> https://github.com/storybookjs/storybook/issues/27535 | ||
argTypes: { | ||
fullName: { | ||
description: "The user's full name", | ||
}, | ||
children: { | ||
control: false, | ||
description: "Content inside the component", | ||
table: { | ||
type: { summary: "ReactNode" }, | ||
}, | ||
}, | ||
}, | ||
} satisfies Meta<typeof UserProfile>; | ||
|
||
export default meta; | ||
export type Story = StoryObj<typeof meta>; | ||
|
||
export const Basic: Story = { | ||
args: { | ||
fullName: "Satoru Gojo", | ||
children: ( | ||
<UserProfileContent> | ||
{UserProfileContentStories.WithActions.args?.children} | ||
</UserProfileContent> | ||
), | ||
}, | ||
}; |
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
73 changes: 73 additions & 0 deletions
73
src/v1/components/data-display/UserProfile/UserProfileContent/UserProfileContent.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,73 @@ | ||
import React from "react"; | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import UserProfileContent from "./UserProfileContent"; | ||
import FlexBox from "../../../layout/FlexBox"; | ||
import { Text } from "../../Text/Text"; | ||
import Button from "../../../inputs/Button/Button"; | ||
|
||
const meta = { | ||
component: UserProfileContent, | ||
tags: ["autodocs"], | ||
decorators: (Story) => ( | ||
<div style={{ width: 300 }}> | ||
<Story /> | ||
</div> | ||
), | ||
argTypes: { | ||
children: { | ||
control: false, | ||
description: "Content inside the component", | ||
table: { | ||
type: { summary: "ReactNode" }, | ||
}, | ||
}, | ||
}, | ||
} satisfies Meta<typeof UserProfileContent>; | ||
|
||
export default meta; | ||
export type Story = StoryObj<typeof meta>; | ||
|
||
const items = [ | ||
{ heading: "Username", value: "Admin" }, | ||
{ heading: "Email", value: "admin@telicent.io" }, | ||
{ heading: "Deployed Organisation", value: "Telicent" }, | ||
{ heading: "UserId", value: "3004958Ed-23-sdf-404-21334" }, | ||
{ heading: "Attributes", value: "GBR" }, | ||
{ heading: "Clearance", value: "SEN" }, | ||
]; | ||
|
||
export const Basic: Story = { | ||
args: { | ||
children: items.slice(0, 3).map((item) => ( | ||
<FlexBox key={item.heading}> | ||
<Text> | ||
<b>{item.heading}</b> | ||
</Text> | ||
<Text>{item.value}</Text> | ||
</FlexBox> | ||
)), | ||
}, | ||
}; | ||
|
||
export const WithActions: Story = { | ||
args: { | ||
children: ( | ||
<> | ||
{items.map((item) => ( | ||
<FlexBox key={item.heading}> | ||
<Text> | ||
<b>{item.heading}</b> | ||
</Text> | ||
<Text>{item.value}</Text> | ||
</FlexBox> | ||
))} | ||
<FlexBox direction="row" columnGap={2} justifyContent="end"> | ||
<Button variant="secondary" disableElevation> | ||
Action | ||
</Button> | ||
<Button disableElevation>Action</Button> | ||
</FlexBox> | ||
</> | ||
), | ||
}, | ||
}; |
20 changes: 20 additions & 0 deletions
20
src/v1/components/data-display/UserProfile/UserProfileContent/UserProfileContent.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,20 @@ | ||
import React, { PropsWithChildren } from "react"; | ||
import MUIAvatar from "@mui/material/Avatar"; | ||
import MUIStack from "@mui/material/Stack"; | ||
|
||
import { H2 } from "../../Text/Text"; | ||
import UserIcon from "../../Icons/UserIcon"; | ||
|
||
const UserProfileContent: React.FC<PropsWithChildren> = ({ children }) => ( | ||
<MUIStack rowGap={2}> | ||
<MUIStack direction="row" columnGap={1} alignItems="center"> | ||
<MUIAvatar variant="circular-outlined" sx={{ width: 32, height: 32 }}> | ||
<UserIcon color="primary" /> | ||
</MUIAvatar> | ||
<H2 variant="h4">User Profile</H2> | ||
</MUIStack> | ||
{children} | ||
</MUIStack> | ||
); | ||
|
||
export default UserProfileContent; |
Oops, something went wrong.