Skip to content

Commit

Permalink
[C-3440] Add Hint component to native harmony (#6904)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Shanks authored Dec 11, 2023
1 parent aab9814 commit 730423c
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/mobile/.storybook/storybook.requires.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ const getStories = () => {
'../src/harmony-native/Box.stories.tsx': require('../src/harmony-native/components/layout/Box/Box.stories.tsx'),
'../src/harmony-native/Flex.stories.tsx': require('../src/harmony-native/components/layout/Flex/Flex.stories.tsx'),
'../src/harmony-native/Paper.stories.tsx': require('../src/harmony-native/components/layout/Paper/Paper.stories.tsx'),
'../src/harmony-native/Avatar.stories.tsx': require('../src/harmony-native/components/Avatar/Avatar.stories.tsx')
'../src/harmony-native/Avatar.stories.tsx': require('../src/harmony-native/components/Avatar/Avatar.stories.tsx'),
'../src/harmony-native/Hint.stories.tsx': require('../src/harmony-native/components/Hint/Hint.stories.tsx')
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import type { Meta, StoryObj } from '@storybook/react-native'

import { IconQuestionCircle } from '@audius/harmony-native'

import { Flex } from '../layout/Flex/Flex'

import type { HintProps } from './Hint'
import { Hint } from './Hint'

const messages = {
hintMessage: 'A helpful hint message to provide information to the user'
}

const meta: Meta<HintProps> = {
title: 'Components/Hint',
component: Hint,
argTypes: {},
args: {
icon: IconQuestionCircle
},
render: (props) => (
<Flex p='l'>
<Hint {...props}>{messages.hintMessage}</Hint>
</Flex>
)
}

export default meta

type Story = StoryObj<HintProps>

export const Default: Story = {}
34 changes: 34 additions & 0 deletions packages/mobile/src/harmony-native/components/Hint/Hint.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import type { Icon } from 'app/harmony-native/icons'

import { Text } from '../Text/Text'
import type { PaperProps } from '../layout'
import { Box, Paper } from '../layout'

export type HintProps = {
icon: Icon
} & PaperProps

export const Hint = (props: HintProps) => {
const { icon: Icon, children, ...other } = props
return (
<Paper
role='alert'
direction='row'
gap='l'
ph='l'
pv='m'
alignItems='center'
backgroundColor='surface2'
shadow='flat'
border='strong'
{...other}
>
<Icon size='l' color='default' />
<Box flex={1}>
<Text variant='body' color='default'>
{children}
</Text>
</Box>
</Paper>
)
}
1 change: 1 addition & 0 deletions packages/mobile/src/harmony-native/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from './Link'
export * from './Text/Text'
export * from './layout'
export * from './Avatar/Avatar'
export * from './Hint/Hint'

0 comments on commit 730423c

Please sign in to comment.