Skip to content

Commit

Permalink
feat: add onboarding state in pills (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
gkartalis authored Mar 11, 2024
1 parent d7ca644 commit 4516d0b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/elements/Pill/Pill.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,17 @@ storiesOf("Pill", module)
</List>
)
})
.add("Onboarding", () => {
return (
<List contentContainerStyle={{ marginHorizontal: 20 }}>
<Pill variant="onboarding" selected>
Yes, I love collecting art
</Pill>
<Pill variant="onboarding" ml={1}>
No, I'm just starting out
</Pill>
</List>
)
})

const src = "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg"
16 changes: 15 additions & 1 deletion src/elements/Pill/Pill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const PILL_VARIANT_NAMES = [
"filter",
"profile",
"search",
"onboarding",
] as const
export type PillState = "default" | "selected" | "disabled"
export type PillVariant = typeof PILL_VARIANT_NAMES[number]
Expand All @@ -28,7 +29,10 @@ export type PillProps = (FlexProps & {
}) &
(
| {
variant?: Extract<PillVariant, "default" | "filter" | "badge" | "search" | "dotted">
variant?: Extract<
PillVariant,
"default" | "filter" | "badge" | "search" | "dotted" | "onboarding"
>
src?: never
}
| { variant: Extract<PillVariant, "profile">; src?: string }
Expand Down Expand Up @@ -126,6 +130,15 @@ const PILL_STATES = {

const PILL_VARIANTS: Record<PillVariant, Record<PillState, FlattenInterpolation<any>>> = {
default: PILL_STATES,
onboarding: {
...PILL_STATES,
default: css`
${PILL_STATES.default}
border-radius: 20px;
height: 40px;
border-color: ${themeGet("colors.black60")};
`,
},
dotted: {
...PILL_STATES,
default: css`
Expand Down Expand Up @@ -193,6 +206,7 @@ const defaultColors: Record<PillState, Color> = {
}
const TEXT_COLOR: Record<PillVariant, Record<PillState, Color>> = {
default: defaultColors,
onboarding: defaultColors,
dotted: {
...defaultColors,
selected: "black100",
Expand Down

0 comments on commit 4516d0b

Please sign in to comment.