diff --git a/packages/.omletrc.json b/.omletrc.json similarity index 100% rename from packages/.omletrc.json rename to .omletrc.json diff --git a/.prettierrc.js b/.prettierrc.js index 869157986..0f53d681d 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -5,4 +5,5 @@ module.exports = { endOfLine: "lf", tabWidth: 2, trailingComma: "es5", + printWidth: 80, }; diff --git a/.storybook/components/SidebarItem/SidebarItem.tsx b/.storybook/components/SidebarItem/SidebarItem.tsx new file mode 100644 index 000000000..19c707c61 --- /dev/null +++ b/.storybook/components/SidebarItem/SidebarItem.tsx @@ -0,0 +1,21 @@ +import React from "react"; +import { StyledSidebarItem } from "./style"; +import StatusTag from "../StatusTag/StatusTag"; + +export type StatusType = "beta" | "deprecated" | "wip"; + +interface SidebarItemProps { + children: React.ReactNode; + status: StatusType; +} + +const SidebarItem = ({ children, status }: SidebarItemProps) => { + return ( + +
{children}
+ {status} +
+ ); +}; + +export default SidebarItem; diff --git a/.storybook/components/SidebarItem/style.ts b/.storybook/components/SidebarItem/style.ts new file mode 100644 index 000000000..a58697e58 --- /dev/null +++ b/.storybook/components/SidebarItem/style.ts @@ -0,0 +1,8 @@ +import { styled } from "@mui/material"; + +export const StyledSidebarItem = styled("div")` + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; +`; diff --git a/.storybook/components/StatusTag/StatusTag.tsx b/.storybook/components/StatusTag/StatusTag.tsx new file mode 100644 index 000000000..44fa6a093 --- /dev/null +++ b/.storybook/components/StatusTag/StatusTag.tsx @@ -0,0 +1,22 @@ +import React, { FC } from "react"; +import { StyledLabel } from "./style"; +import { StatusType } from "../SidebarItem/SidebarItem"; + +interface StatusTagProps { + children: React.ReactNode; + type: StatusType; +} + +const TypeToLabel: Record = { + beta: "Beta", + deprecated: "Deprecated", + wip: "Work in Progress", +}; + +const StatusTag: FC = ({ type }) => { + const label = TypeToLabel[type]; + + return {label}; +}; + +export default StatusTag; diff --git a/.storybook/components/StatusTag/style.ts b/.storybook/components/StatusTag/style.ts new file mode 100644 index 000000000..caf4013bb --- /dev/null +++ b/.storybook/components/StatusTag/style.ts @@ -0,0 +1,36 @@ +import { styled } from "@mui/material"; +import { StatusType } from "../SidebarItem/SidebarItem"; + +interface StyledLabelProps { + type: StatusType; +} + +const TypeToColor: Record = { + beta: "#703CBE", + deprecated: "#C61128", + wip: "#D8921F", +}; + +const TypeToBorderColor: Record = { + beta: "#7A41CE", + deprecated: "#DC132C", + wip: "#F5A623", +}; + +export const StyledLabel = styled("label")` + ${(props: StyledLabelProps) => { + const { type } = props; + const color = TypeToColor[type]; + const borderColor = TypeToBorderColor[type]; + + return ` + margin: 0 16px 0 8px; + padding: 1px 4px; + font-size: 10px; + font-weight: 600; + color: ${color}; + border: solid 1px ${borderColor}; + border-radius: 2px; + `; + }} +`; diff --git a/.storybook/main.js b/.storybook/main.js index 26c51641b..88527bfe3 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -35,6 +35,7 @@ module.exports = { getAbsolutePath("@storybook/addon-a11y"), getAbsolutePath("@storybook/react"), getAbsolutePath("storybook-addon-pseudo-states"), + getAbsolutePath("@geometricpanda/storybook-addon-badges"), ], framework: { name: getAbsolutePath("@storybook/react-webpack5"), diff --git a/.storybook/manager-head.html b/.storybook/manager-head.html index 37555a6a0..d548c754d 100644 --- a/.storybook/manager-head.html +++ b/.storybook/manager-head.html @@ -1,27 +1,30 @@ - - + + - + + + SDS Design System