-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
aab9814
commit 730423c
Showing
4 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
packages/mobile/src/harmony-native/components/Hint/Hint.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
34
packages/mobile/src/harmony-native/components/Hint/Hint.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters