Skip to content

Commit

Permalink
🎨 Improve story for Divider (#744)
Browse files Browse the repository at this point in the history
* 🎨 Improve story for Divider

* 🎨 Remove unused imports

* 🎨 Remove blank line
  • Loading branch information
vnys authored Oct 26, 2020
1 parent c64b092 commit 2552da3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
7 changes: 4 additions & 3 deletions apps/storybook-react/stories/Divider.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import React from 'react'
import styled from 'styled-components'
import { Divider, DividerProps } from '@equinor/eds-core-react'
Expand All @@ -22,9 +25,7 @@ export default {
},
} as Meta

type WrapperProps = React.HTMLAttributes<HTMLDivElement>

const Wrapper = styled.div<WrapperProps>`
const Wrapper = styled.div`
padding: 32px;
background-color: #999;
`
Expand Down
25 changes: 13 additions & 12 deletions libraries/core-react/src/Divider/Divider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@ export type DividerProps = {
className?: string
}

export const Divider = forwardRef<HTMLHRElement, DividerProps>(
({ color = 'medium', variant = 'medium', className = '' }, ref) => {
const styleProps = {
backgroundColor: tokens.color[color],
marginTop: tokens[variant].spacings.top,
marginBottom: tokens[variant].spacings.bottom,
dividerHeight: tokens.height,
}
return <StyledDivider {...styleProps} className={className} ref={ref} />
},
)
export const Divider = forwardRef<HTMLHRElement, DividerProps>(function Divider(
{ color = 'medium', variant = 'medium', className = '' },
ref,
) {
const styleProps = {
backgroundColor: tokens.color[color],
marginTop: tokens[variant].spacings.top,
marginBottom: tokens[variant].spacings.bottom,
dividerHeight: tokens.height,
}
return <StyledDivider {...styleProps} className={className} ref={ref} />
})

Divider.displayName = 'Divider'
// Divider.displayName = 'Divider'
2 changes: 1 addition & 1 deletion libraries/core-react/src/Divider/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { Divider, DividerProps } from './Divider'
export * from './Divider'

0 comments on commit 2552da3

Please sign in to comment.