-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- fix styles
- Loading branch information
Showing
5 changed files
with
113 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
'use client'; | ||
|
||
import type { BadgeProps } from './badge.types'; | ||
|
||
import { css, styled } from '@/styles'; | ||
|
||
export const BadgeWrapper = styled.div` | ||
display: flex; | ||
align-items: center; | ||
width: fit-content; | ||
gap: 16px; | ||
`; | ||
|
||
export const AdditionalText = styled.span` | ||
color: ${({ theme }) => theme.colors.lightGrey}; | ||
font-size: ${({ theme }) => theme.fontSizes.label.l}; | ||
font-weight: ${({ theme }) => theme.fontWeight.bold}; | ||
letter-spacing: ${({ theme }) => theme.letterSpacing.label}; | ||
text-transform: uppercase; | ||
`; | ||
|
||
export const StyledBadge = styled.span<BadgeProps>` | ||
display: flex; | ||
align-items: center; | ||
gap: 6px; | ||
font-size: ${({ theme }) => theme.fontSizes.label.m}; | ||
font-weight: ${({ theme }) => theme.fontWeight.bold}; | ||
line-height: ${({ theme }) => theme.lineHeight.label}; | ||
letter-spacing: ${({ theme }) => theme.letterSpacing.label}; | ||
text-transform: uppercase; | ||
${({ variant }) => { | ||
switch (variant) { | ||
case 'primary': | ||
return css` | ||
border-radius: 16px; | ||
padding: 6px 10px; | ||
color: ${({ theme }) => theme.colors.text.lightGrey}; | ||
background-color: ${({ theme }) => theme.colors.mediumGrey}; | ||
box-shadow: 0 0 0 1px ${({ theme }) => theme.colors.borderGradient}; | ||
`; | ||
case 'secondary': | ||
return css` | ||
border-radius: 24px; | ||
padding: 8px 12px; | ||
color: ${({ theme }) => theme.colors.text.alwayLightGrey}; | ||
background: ${({ theme }) => theme.colors.blueGradient}; | ||
box-shadow: | ||
0px 1.66px 0.83px 0px rgba(201, 212, 251, 0.1) inset, | ||
0px -0.83px 0.83px 0px rgba(16, 46, 151, 0.1) inset; | ||
`; | ||
} | ||
}} | ||
`; |
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,8 @@ | ||
import type { Icon, IconWeight } from '@phosphor-icons/react'; | ||
|
||
export interface BadgeProps { | ||
variant?: 'primary' | 'secondary'; | ||
icon?: Icon; | ||
iconWeight?: IconWeight; | ||
additionalText?: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { AdditionalText, BadgeWrapper, StyledBadge } from './badge.styles'; | ||
import type { BadgeProps } from './badge.types'; | ||
|
||
export const Badge = ({ | ||
children, | ||
variant = 'primary', | ||
additionalText, | ||
icon: Icon, | ||
iconWeight = 'fill', | ||
}: Component<BadgeProps>) => { | ||
const hasAdditionalText = variant === 'secondary' && additionalText; | ||
|
||
return ( | ||
<BadgeWrapper> | ||
{hasAdditionalText && <AdditionalText>{additionalText}</AdditionalText>} | ||
<StyledBadge variant={variant}> | ||
{Icon && <Icon size={16} weight={iconWeight} />} | ||
<h3>{children}</h3> | ||
</StyledBadge> | ||
</BadgeWrapper> | ||
); | ||
}; |
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