diff --git a/docs/src/components/FAB/FAB.stories.mdx b/docs/src/components/FAB/FAB.stories.mdx new file mode 100644 index 00000000..ac447fe5 --- /dev/null +++ b/docs/src/components/FAB/FAB.stories.mdx @@ -0,0 +1,56 @@ +import {Meta} from '@storybook/addon-docs/blocks'; +import {Light, Dark} from './index'; + + + +# FAB + +> [FAB] Floating Action Button is a component for represent the primary action of screen + +## Usage + +```tsx +import {FAB} from 'dooboo-ui'; + +; +``` + +## Props + +| | Types | Description | Default | +| -------------- | ------------------------------------------- | ------------------------------------------ | ------- | +| isActive | `boolean` | | | +| FABItems | `Array` | List of id and iconName form each FABItems | | +| onPressFAB | `() => void` | Press callback for main FAB button | | +| onPressFABItem | `(item?: Item) => void` | Press callback for main FAB button | | +| renderFAB? | `() => ReactElement` | | | +| renderFABItem? | `(item: Item, idx: number) => ReactElement` | | | +| style? | `Styles` | | | +| styles? | `Styles` | Extra Props for FAB styles | | + +## FABItem + +| | Types | Description | Default | +| ---- | ---------- | ---------------------------------------------------------------------------------- | ------- | +| icon | `IconName` | | | +| id | `string` | Id for distinguishing from other FABItems that passed from onPressFABItem callback | | + +## Styles + +| | Types | Description | Default | +| ---------- | ---------------------- | ----------------------- | ------- | +| FAB? | `StyleProp` | Style for main FAB | | +| FABItem? | `StyleProp` | Style for FABItem | | +| iconSize? | `number` | | 24 | +| buttonSize | `ButtonSize` | | | +| gap? | `number` | Gap between FAB Buttons | 20 | + +## Demo + +#### Light Theme + + + +#### Dark Theme + + diff --git a/docs/src/components/FAB/index.tsx b/docs/src/components/FAB/index.tsx new file mode 100644 index 00000000..fd5f33e4 --- /dev/null +++ b/docs/src/components/FAB/index.tsx @@ -0,0 +1,55 @@ +import {FAB, ThemeProvider, withTheme} from 'dooboo-ui'; +import {FC, ReactElement, useState} from 'react'; +import {SafeAreaView, View} from 'react-native'; + +import styled from '@emotion/native'; +import {useFonts} from 'expo-font'; + +const StoryContainer = styled.View` + flex: 1; + width: 100%; + height: 300px; + align-self: stretch; + background-color: ${({theme}) => theme.background}; +`; + +const FABContainer: FC = () => { + const [active, setActive] = useState(false); + + const [fontsLoaded] = useFonts({ + IcoMoon: require('../../assets/doobooui.ttf'), + }); + + if (!fontsLoaded) return ; + + return ( + + + setActive((prev) => !prev)} + onPressFABItem={() => {}} + /> + + + ); +}; + +const FABStory = withTheme(FABContainer); + +export const Light = (): ReactElement => ( + + + +); + +export const Dark = (): ReactElement => ( + + + +);