This repository has been archived by the owner on Mar 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
20 changed files
with
236 additions
and
237 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
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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,17 +1,19 @@ | ||
import styled from '@emotion/styled' | ||
|
||
import { includeVariant, TIncludeVariantProps } from './variants' | ||
import { colorStates } from './variants/_colorVariants' | ||
|
||
const StyledButton = styled('div')<TIncludeVariantProps & { iconAlign?: 'left' | 'right' }>` | ||
const StyledButton = styled('div')<{ | ||
disabled?: boolean | ||
iconAlign?: 'left' | 'right' | ||
colorStates: colorStates | ||
}>` | ||
position: relative; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
cursor: pointer; | ||
user-select: none; | ||
flex-direction: ${(props) => (props.iconAlign === 'left' ? 'row' : 'row-reverse')}; | ||
${(props) => includeVariant(props, 'button')}; | ||
` | ||
|
||
export default StyledButton |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,50 +1,21 @@ | ||
import { colorStates } from './_colors' | ||
import colorVariants from './_colorVariants' | ||
import StyledButton from '../StyledButton' | ||
import ButtonText from '../ButtonText' | ||
|
||
import primary from './primary' | ||
import secondary from './secondary' | ||
import transparent from './transparent' | ||
import PrimaryStyledButton from './primary/PrimaryStyledButton' | ||
import PrimaryButtonText from './primary/PrimaryButtonText' | ||
|
||
export interface variantProps { | ||
color: colorStates | ||
disabled?: boolean | ||
} | ||
|
||
export type possibleVariants = 'primary' | 'secondary' | 'transparent' | ||
|
||
const variants = (props: { | ||
colorStates?: colorStates | ||
}): { [index in possibleVariants]: { button?: any; text?: any } } => ({ | ||
primary: primary({ | ||
color: { | ||
...colorVariants.primary, | ||
...props.colorStates | ||
} | ||
}), | ||
secondary: secondary({ | ||
color: { | ||
...colorVariants.secondary, | ||
...props.colorStates | ||
} | ||
}), | ||
transparent: transparent({ | ||
color: { | ||
...colorVariants.transparent, | ||
...props.colorStates | ||
} | ||
}) | ||
}) | ||
export type possibleVariants = 'primary' | ||
|
||
export type TIncludeVariantProps = { | ||
colorStates?: colorStates | ||
variant: possibleVariants | ||
type TVariant = { | ||
Button: typeof StyledButton | ||
Text: typeof ButtonText | ||
} | ||
|
||
export const includeVariant = ( | ||
props: { colorStates?: colorStates; variant: possibleVariants }, | ||
element: string | ||
) => { | ||
return variants(props)[props.variant][element] | ||
const variants: { [index in possibleVariants]: TVariant } = { | ||
primary: { | ||
Button: PrimaryStyledButton, | ||
Text: PrimaryButtonText | ||
} | ||
} | ||
|
||
export default variants |
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
src/components/elements/Button/variants/primary/PrimaryButtonText.ts
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,9 @@ | ||
import styled from '@emotion/styled' | ||
|
||
import ButtonText from '../../ButtonText' | ||
|
||
const PrimaryButtonText = styled(ButtonText)` | ||
color: ${(props) => props.theme.palette['white']}; | ||
` | ||
|
||
export default PrimaryButtonText |
Oops, something went wrong.