diff --git a/packages/react/.storybook/story-config.ts b/packages/react/.storybook/story-config.ts index b5953dd0..c1a1b91f 100644 --- a/packages/react/.storybook/story-config.ts +++ b/packages/react/.storybook/story-config.ts @@ -39,6 +39,7 @@ export type Stories = | 'Button' | 'ColorModeToggle' | 'Colors' + | 'Divider' | 'Drawer' | 'Grid' | 'IconButton' @@ -92,10 +93,10 @@ const StoryConfig: StorybookConfig = { }, AppBar: { hierarchy: `${StorybookCategories.Surfaces}/App Bar`, - }, + }, Avatar: { hierarchy: `${StorybookCategories.DataDisplay}/Avatar`, - }, + }, Box: { hierarchy: `${StorybookCategories.Layout}/Box`, }, @@ -111,6 +112,9 @@ const StoryConfig: StorybookConfig = { Colors: { hierarchy: `${StorybookCategories.Foundations}/Colors`, }, + Divider: { + hierarchy: `${StorybookCategories.DataDisplay}/Divider`, + }, Drawer: { hierarchy: `${StorybookCategories.Navigation}/Drawer`, }, diff --git a/packages/react/src/components/Avatar/Avatar.tsx b/packages/react/src/components/Avatar/Avatar.tsx index d63d23e2..f5d76c06 100644 --- a/packages/react/src/components/Avatar/Avatar.tsx +++ b/packages/react/src/components/Avatar/Avatar.tsx @@ -21,7 +21,7 @@ import clsx from 'clsx'; import {FC, ReactElement} from 'react'; import {WithWrapperProps} from '../../models'; import {composeComponentDisplayName} from '../../utils'; -import './app-bar.scss'; +import './avatar.scss'; export type AvatarProps = MuiAvatarProps; diff --git a/packages/react/src/components/Divider/Divider.stories.mdx b/packages/react/src/components/Divider/Divider.stories.mdx new file mode 100644 index 00000000..e426607f --- /dev/null +++ b/packages/react/src/components/Divider/Divider.stories.mdx @@ -0,0 +1,69 @@ +import {ArgsTable, Source, Story, Canvas, Meta} from '@storybook/addon-docs'; +import dedent from 'ts-dedent'; +import StoryConfig from '../../../.storybook/story-config.ts'; +import Divider from './Divider.tsx'; +import List from '../List/List.tsx'; +import ListItem from '../ListItem/ListItem.tsx'; +import ListItemText from '../ListItemText/ListItemText.tsx'; + +export const meta = { + component: Divider, + title: StoryConfig.Divider.hierarchy, +}; + + + +export const Template = args => ( + + + + + + + + + +); + +# Divider + +- [Overview](#overview) +- [Props](#props) +- [Usage](#usage) + +## Overview + +A divider is a thin line that groups content in lists and layouts. + + + {Template.bind({})} + + +## Props + + + +## Usage + +Import and use the `Divider` component in your components as follows. + + + ); +}`} +/> diff --git a/packages/react/src/components/Divider/Divider.tsx b/packages/react/src/components/Divider/Divider.tsx new file mode 100644 index 00000000..781a3fa8 --- /dev/null +++ b/packages/react/src/components/Divider/Divider.tsx @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import MuiDivider, {DividerProps as MuiDividerProps} from '@mui/material/Divider'; +import clsx from 'clsx'; +import {FC, ReactElement} from 'react'; +import {WithWrapperProps} from '../../models'; +import {composeComponentDisplayName} from '../../utils'; +import './divider.scss'; + +export type DividerProps = MuiDividerProps; + +const COMPONENT_NAME: string = 'Divider'; + +const Divider: FC & WithWrapperProps = (props: DividerProps): ReactElement => { + const {className, ...rest} = props; + + const classes: string = clsx('oxygen-divider', className); + + return ; +}; + +Divider.displayName = composeComponentDisplayName(COMPONENT_NAME); +Divider.muiName = COMPONENT_NAME; +Divider.defaultProps = {}; + +export default Divider; diff --git a/packages/react/src/components/Divider/__tests__/Divider.test.tsx b/packages/react/src/components/Divider/__tests__/Divider.test.tsx new file mode 100644 index 00000000..9f036757 --- /dev/null +++ b/packages/react/src/components/Divider/__tests__/Divider.test.tsx @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import {render} from '@unit-testing'; +import Divider from '../Divider'; + +describe('Divider', () => { + it('should render successfully', () => { + const {baseElement} = render(); + expect(baseElement).toBeTruthy(); + }); + + it('should match the snapshot', () => { + const {baseElement} = render(); + expect(baseElement).toMatchSnapshot(); + }); +}); diff --git a/packages/react/src/components/Divider/__tests__/__snapshots__/Divider.test.tsx.snap b/packages/react/src/components/Divider/__tests__/__snapshots__/Divider.test.tsx.snap new file mode 100644 index 00000000..d48e0ea7 --- /dev/null +++ b/packages/react/src/components/Divider/__tests__/__snapshots__/Divider.test.tsx.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Divider should match the snapshot 1`] = ` + +
+
+
+ +`; diff --git a/packages/react/src/components/Divider/divider.scss b/packages/react/src/components/Divider/divider.scss new file mode 100644 index 00000000..54552daf --- /dev/null +++ b/packages/react/src/components/Divider/divider.scss @@ -0,0 +1,21 @@ +/** + * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +.oxygen-divider { + /* Add Styles */ +} diff --git a/packages/react/src/components/Divider/index.ts b/packages/react/src/components/Divider/index.ts new file mode 100644 index 00000000..ddf1c9d9 --- /dev/null +++ b/packages/react/src/components/Divider/index.ts @@ -0,0 +1,20 @@ +/** + * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export {default} from './Divider'; +export type {DividerProps} from './Divider'; diff --git a/packages/react/src/components/Drawer/__tests__/__snapshots__/Drawer.test.tsx.snap b/packages/react/src/components/Drawer/__tests__/__snapshots__/Drawer.test.tsx.snap new file mode 100644 index 00000000..90365764 --- /dev/null +++ b/packages/react/src/components/Drawer/__tests__/__snapshots__/Drawer.test.tsx.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Drawer should match the snapshot 1`] = ` + +
+ +`; diff --git a/packages/react/src/components/index.ts b/packages/react/src/components/index.ts index 4146646b..ee11d1be 100644 --- a/packages/react/src/components/index.ts +++ b/packages/react/src/components/index.ts @@ -28,6 +28,9 @@ export * from './Button'; export {default as ColorModeToggle} from './ColorModeToggle'; export * from './ColorModeToggle'; +export {default as Divider} from './Divider'; +export * from './Divider'; + export {default as Drawer} from './Drawer'; export * from './Drawer';