-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* u tabs * u stories * a steps * f tabs * a changeset * u tabs * e step
- Loading branch information
Showing
8 changed files
with
303 additions
and
35 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@status-im/components': minor | ||
--- | ||
|
||
add Step and Tabs with Step |
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
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
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 @@ | ||
export { Step, type StepProps } from './step' |
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,78 @@ | ||
import { Stack } from '@tamagui/core' | ||
|
||
import { Step } from './step' | ||
|
||
import type { StepProps } from './step' | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
const meta: Meta<typeof Step> = { | ||
title: 'Components/Step', | ||
component: Step, | ||
argTypes: { | ||
value: { | ||
control: { | ||
type: 'number', | ||
min: 0, | ||
max: 1000, | ||
}, | ||
}, | ||
type: { | ||
control: 'select', | ||
options: ['neutral', 'complete', 'active'], | ||
}, | ||
}, | ||
parameters: { | ||
design: { | ||
type: 'figma', | ||
url: 'https://www.figma.com/file/IBmFKgGL1B4GzqD8LQTw6n/Design-System-for-Desktop%2FWeb?type=design&node-id=18126-5278&mode=design&t=QNu79iGJYnhdNqOn-4', | ||
}, | ||
}, | ||
} | ||
|
||
type Story = StoryObj<StepProps> | ||
|
||
export const Neutral: Story = { | ||
args: { | ||
value: 1, | ||
type: 'neutral', | ||
}, | ||
} | ||
|
||
export const Complete: Story = { | ||
args: { | ||
value: 1, | ||
type: 'complete', | ||
}, | ||
} | ||
|
||
export const Active: Story = { | ||
args: { | ||
value: 1, | ||
type: 'active', | ||
}, | ||
} | ||
|
||
export const AllVariants: Story = { | ||
args: {}, | ||
render: () => ( | ||
<Stack space flexDirection="row"> | ||
<Stack space> | ||
<Step type="neutral" value={1} /> | ||
<Step type="neutral" value={10} /> | ||
<Step type="neutral" value={999} /> | ||
</Stack> | ||
<Stack space> | ||
<Step type="complete" value={1} /> | ||
<Step type="complete" value={10} /> | ||
<Step type="complete" value={999} /> | ||
</Stack> | ||
<Stack space> | ||
<Step type="active" value={1} /> | ||
<Step type="active" value={10} /> | ||
<Step type="active" value={999} /> | ||
</Stack> | ||
</Stack> | ||
), | ||
} | ||
|
||
export default meta |
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,74 @@ | ||
import { Stack, styled } from '@tamagui/core' | ||
|
||
import { Text } from '../text' | ||
|
||
import type { ColorTokens } from '@tamagui/core' | ||
|
||
// todo?: rename netural to default | ||
export type StepVariants = 'neutral' | 'complete' | 'active' | ||
|
||
type Props = { | ||
value: number | ||
type?: StepVariants | ||
} | ||
|
||
const Step = (props: Props) => { | ||
const { value, type = 'neutral' } = props | ||
|
||
return ( | ||
<Base> | ||
<Content type={type}> | ||
<Text size={11} weight="medium" color={textColors[type]}> | ||
{value} | ||
</Text> | ||
</Content> | ||
</Base> | ||
) | ||
} | ||
|
||
export { Step } | ||
export type { Props as StepProps } | ||
|
||
const Base = styled(Stack, { | ||
padding: 2, | ||
display: 'inline-flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
flexBasis: 'fit-content', | ||
}) | ||
|
||
const Content = styled(Stack, { | ||
backgroundColor: '$white-100', | ||
paddingHorizontal: 3, | ||
paddingVertical: 0, | ||
borderRadius: '$6', | ||
minHeight: 18, | ||
maxHeight: 18, | ||
minWidth: 18, | ||
maxWidth: 28, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
borderWidth: 1, | ||
borderColor: 'transparent', | ||
|
||
variants: { | ||
type: { | ||
neutral: { | ||
backgroundColor: '$transparent', | ||
borderColor: '$neutral-20', | ||
}, | ||
complete: { | ||
backgroundColor: '$blue-50', | ||
}, | ||
active: { | ||
backgroundColor: '$blue-50-opa-10', | ||
}, | ||
}, | ||
}, | ||
}) | ||
|
||
const textColors: Record<NonNullable<Props['type']>, ColorTokens> = { | ||
neutral: '$neutral-100', | ||
complete: '$white-100', | ||
active: '$neutral-100', | ||
} |
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
Oops, something went wrong.
762a698
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
status-components – ./packages/components
status-components-status-im-web.vercel.app
status-components-git-main-status-im-web.vercel.app
status-components.vercel.app
762a698
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
status-web – ./apps/web
status-web-git-main-status-im-web.vercel.app
status-web.vercel.app
status-web-status-im-web.vercel.app