This repository has been archived by the owner on Oct 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Saliou Diallo
committed
Jul 27, 2022
1 parent
49926ba
commit 2add00d
Showing
8 changed files
with
147 additions
and
52 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
packages/stems/src/components/PillButton/PillButton.module.css
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,42 @@ | ||
.button { | ||
height: unset !important; | ||
padding: 10px 0; | ||
border-radius: 100px; | ||
border: 1px solid var(--neutral-light-4); | ||
background: var(--white); | ||
} | ||
.buttonText { | ||
display: flex; | ||
align-items: center; | ||
text-transform: uppercase; | ||
font-size: var(--font-xs) !important; | ||
color: var(--neutral) !important; | ||
letter-spacing: unset !important; | ||
} | ||
.button:hover { | ||
transform: scale3d(1.01, 1.01, 1.01) !important; | ||
border: unset !important; | ||
} | ||
.button:active { | ||
transform: scale3d(0.99, 0.99, 0.99) !important; | ||
} | ||
.button:hover .buttonText, | ||
.button:active .buttonText { | ||
color: var(--white) !important; | ||
} | ||
.button.primary:hover, | ||
.button.primary:hover .buttonText { | ||
background: var(--primary) !important; | ||
} | ||
.button.primary:active, | ||
.button.primary:active .buttonText { | ||
background: var(--primary-dark-2) !important; | ||
} | ||
.button.secondary:hover, | ||
.button.secondary:hover .buttonText { | ||
background: var(--secondary-light-2) !important; | ||
} | ||
.button.secondary:active, | ||
.button.secondary:active .buttonText { | ||
background: var(--secondary) !important; | ||
} |
23 changes: 23 additions & 0 deletions
23
packages/stems/src/components/PillButton/PillButton.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,23 @@ | ||
import { Story } from '@storybook/react' | ||
|
||
import { PillButton, PillButtonProps } from './' | ||
|
||
export default { | ||
component: PillButton, | ||
title: 'Components/PillButton' | ||
} | ||
|
||
const defaultProps: PillButtonProps = { | ||
text: 'Pill Button' | ||
} | ||
|
||
const Template: Story<PillButtonProps> = (args) => { | ||
return <PillButton {...defaultProps} {...args} /> | ||
} | ||
|
||
// Default | ||
export const Default = Template.bind({}) | ||
|
||
// Disabled | ||
export const Disabled = Template.bind({}) | ||
Disabled.args = { disabled: true } |
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,29 @@ | ||
import cn from 'classnames' | ||
|
||
import { Button, Type as ButtonType } from 'components/Button' | ||
|
||
import styles from './PillButton.module.css' | ||
import { PillButtonProps, Type as PillButtonType } from './types' | ||
|
||
const TYPE_STYLE_MAP = { | ||
[PillButtonType.PRIMARY]: styles.primary, | ||
[PillButtonType.SECONDARY]: styles.secondary | ||
} | ||
export const PillButton = (props: PillButtonProps) => { | ||
const { | ||
text, | ||
onClick, | ||
type = PillButtonType.PRIMARY, | ||
className, | ||
textClassName | ||
} = props | ||
return ( | ||
<Button | ||
className={cn(styles.button, TYPE_STYLE_MAP[type], className)} | ||
textClassName={cn(styles.buttonText, textClassName)} | ||
type={ButtonType.COMMON} | ||
text={text} | ||
onClick={onClick} | ||
/> | ||
) | ||
} |
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,2 @@ | ||
export { PillButton } from './PillButton' | ||
export { PillButtonProps, Type } from './types' |
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,18 @@ | ||
import { HTMLAttributes } from 'react' | ||
// import { HTMLAttributes, ReactNode } from 'react' | ||
import * as React from 'react' | ||
|
||
export enum Type { | ||
PRIMARY = 'primary', | ||
SECONDARY = 'secondary' | ||
} | ||
|
||
export type PillButtonProps = HTMLAttributes<HTMLButtonElement> & { | ||
text: any | ||
// text: ReactNode | ||
onClick?: (event: React.MouseEvent) => void | ||
disabled?: boolean | ||
type?: Type | ||
className?: string | ||
textClassName?: string | ||
} |
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