Skip to content

Commit 212f121

Browse files
Curian LeeCurian Lee
authored andcommitted
feat: add divider component
1 parent 5f6ff57 commit 212f121

6 files changed

Lines changed: 57 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { Meta, Story } from '@storybook/react';
2+
import React from 'react';
3+
4+
import { BaseContainer } from '../../Layout/GlintsContainer/GlintsContainer';
5+
import { Divider } from './Divider';
6+
7+
(Divider as React.FunctionComponent<void>).displayName = 'Divider';
8+
9+
export default {
10+
title: '@next/Divider',
11+
component: Divider,
12+
decorators: [Story => <BaseContainer>{Story()}</BaseContainer>],
13+
} as Meta;
14+
15+
const Template: Story<void> = () => (
16+
<div>
17+
some text
18+
<Divider />
19+
another text after divider
20+
</div>
21+
);
22+
23+
export const Interactive = Template.bind({});
24+
25+
Interactive.args = {};

src/@next/Divider/Divider.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import React from 'react';
2+
import { DividerStyle } from './DividerStyle';
3+
4+
export type DividerProps = React.HTMLAttributes<HTMLDivElement>;
5+
6+
export const Divider = ({ ...props }: DividerProps) => (
7+
<DividerStyle {...props} />
8+
);

src/@next/Divider/DividerStyle.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import styled from 'styled-components';
2+
import { Neutral } from '../utilities/colors';
3+
import { DividerProps } from './Divider';
4+
5+
export const DividerStyle = styled.div<DividerProps>`
6+
margin: 0;
7+
background-color: ${Neutral.B85};
8+
width: 100%;
9+
height: 1px;
10+
`;

src/@next/Divider/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './Divider';

test/e2e/divider/divider.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { test, expect, Page } from '@playwright/test';
2+
import { StoryBookPage } from '../storybookPage';
3+
4+
const getPage = (page: Page) =>
5+
new StoryBookPage(page, '?path=/story/next-divider--interactive');
6+
7+
test.describe('Badge - standard size', () => {
8+
test('default', async ({ page }) => {
9+
const dividerPage = getPage(page);
10+
await dividerPage.goto();
11+
await expect(dividerPage.container).toHaveScreenshot('divider.png');
12+
});
13+
});
4.92 KB
Loading

0 commit comments

Comments
 (0)