diff --git a/src/components/Base/Base.stories.tsx b/src/components/Base/Base.stories.tsx index 2804a4fd08..950f670eb7 100644 --- a/src/components/Base/Base.stories.tsx +++ b/src/components/Base/Base.stories.tsx @@ -8,31 +8,35 @@ storiesOf('Base', module).add('all', () => (
  • - radius s + + If radius props is specified as s, border-radius becomes 6px. +
  • - radius m + + If radius props is specified as m, border-radius becomes 8px. +
  • -
  • - - custom base - -
  • )) const List = styled.ul` - padding: 8px 24px; + margin: 0; + padding: 24px; + background-color: #eee; list-style: none; -` + & > li:not(:first-child) { + margin-top: 24px; + } +` const Txt = styled.p` - padding: 8px; + margin: 0; + padding: 24px; ` - -const CustomBase = styled(Base)` - border: solid 1px; +const Bold = styled.span` + font-weight: bold; ` diff --git a/src/components/Base/Base.tsx b/src/components/Base/Base.tsx index 190e7f1629..cd5155be6f 100644 --- a/src/components/Base/Base.tsx +++ b/src/components/Base/Base.tsx @@ -1,39 +1,26 @@ -import * as React from 'react' +import React, { ReactNode, forwardRef } from 'react' import styled, { css } from 'styled-components' -type Radius = 's' | 'm' - -interface Props { - radius?: Radius - children?: React.ReactNode +type Props = { + children: ReactNode + radius?: 's' | 'm' className?: string } -const BaseComponent: React.FC = ({ radius = 'm', children, className = '' }) => { +export const Base = forwardRef(({ radius = 'm', ...props }, ref) => { const radiusMap = { s: '6px', m: '8px', } + return +}) - return ( - - {children} - - ) -} - -interface WrapperProps { - radius: string -} - -const Wrapper = styled.div` - ${({ radius }: WrapperProps) => { +const Wrapper = styled.div<{ radius: string }>` + ${({ radius }) => { return css` border-radius: ${radius}; box-shadow: rgba(51, 51, 51, 0.3) 1px 1px 4px 0; - overflow: hidden; + background-color: #fff; ` }} ` - -export const Base = BaseComponent diff --git a/src/components/Base/README.md b/src/components/Base/README.md new file mode 100644 index 0000000000..b19ffa202d --- /dev/null +++ b/src/components/Base/README.md @@ -0,0 +1,13 @@ +# Base + +```tsx +import { Base } from 'smarthr-ui' + +text +``` + +## props + +| Name | Required | Type | DefaultValue | Description | +| ------ | -------- | ------------------------------ | ------------ | ------------------- | +| radius | - | **string**
    's' | 'm' | 'm' | border-radius size. |