-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DApp-1804 tag component added in blocks (#1805)
* tag in progress * implemented tag component * Tag component implemented in blocks
- Loading branch information
1 parent
ea96da6
commit cbd2381
Showing
7 changed files
with
98 additions
and
5 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,43 @@ | ||
import { getTextVariantStyles } from 'blocks/Blocks.utils'; | ||
import { FC } from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
export type TagVariant = 'default' | 'success' | 'danger' | 'warning' | 'info' | 'disabled'; | ||
|
||
export type TagProps = { | ||
label: string; | ||
variant?: TagVariant; | ||
}; | ||
|
||
const StyledTagContainer = styled.div<{ variant: TagVariant }>` | ||
align-items: center; | ||
border-radius: var(--radius-xs); | ||
background: var(--components-tag-background-${({ variant }) => variant}); | ||
display: flex; | ||
gap: var(--spacing-xxxs); | ||
padding: var(--spacing-none) var(--spacing-xxxs); | ||
width: max-content; | ||
`; | ||
|
||
const StyledTagText = styled.span<{ variant: TagVariant }>` | ||
${({ variant }) => getTextVariantStyles('bes-semibold', `components-tag-text-${variant}`)} | ||
`; | ||
|
||
const StyledTagIcon = styled.div<{ variant: TagVariant }>` | ||
background: var(--components-tag-icon-${({ variant }) => variant}); | ||
border-radius: var(--radius-lg); | ||
flex-shrink: 0; | ||
height: 10px; | ||
width: 10px; | ||
`; | ||
|
||
const Tag: FC<TagProps> = ({ label, variant = 'default' }) => { | ||
return ( | ||
<StyledTagContainer variant={variant}> | ||
<StyledTagIcon variant={variant} /> | ||
<StyledTagText variant={variant}>{label}</StyledTagText> | ||
</StyledTagContainer> | ||
); | ||
}; | ||
|
||
export { Tag }; |
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 * from './Tag'; |
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,44 @@ | ||
import { iconSemantics } from './semantics.icon'; | ||
import { strokeSemantics } from './semantics.stroke'; | ||
import { surfaceSemantics } from './semantics.surface'; | ||
import { textSemantics } from './semantics.text'; | ||
|
||
export const tagSemantics = { | ||
'background-default': { light: surfaceSemantics['tertiary'].light, dark: surfaceSemantics['tertiary'].dark }, | ||
'background-success': { | ||
light: surfaceSemantics['state-success-subtle'].light, | ||
dark: surfaceSemantics['state-success-subtle'].dark, | ||
}, | ||
'background-danger': { | ||
light: surfaceSemantics['state-danger-subtle'].light, | ||
dark: surfaceSemantics['state-danger-subtle'].dark, | ||
}, | ||
'background-warning': { | ||
light: surfaceSemantics['state-warning-subtle'].light, | ||
dark: surfaceSemantics['state-warning-subtle'].dark, | ||
}, | ||
'background-info': { | ||
light: surfaceSemantics['state-info-subtle'].light, | ||
dark: surfaceSemantics['state-info-subtle'].dark, | ||
}, | ||
'background-disabled': { | ||
light: surfaceSemantics['state-disabled'].light, | ||
dark: surfaceSemantics['state-disabled'].dark, | ||
}, | ||
|
||
'stroke-bg': { light: strokeSemantics['secondary'].light, dark: strokeSemantics['secondary'].dark }, | ||
|
||
'text-default': { light: textSemantics['primary'].light, dark: textSemantics['primary'].dark }, | ||
'text-success': { light: textSemantics['state-success-bold'].light, dark: textSemantics['state-success-bold'].dark }, | ||
'text-warning': { light: textSemantics['state-warning-bold'].light, dark: textSemantics['state-warning-bold'].dark }, | ||
'text-danger': { light: textSemantics['state-danger-bold'].light, dark: textSemantics['state-danger-bold'].dark }, | ||
'text-info': { light: textSemantics['state-info-bold'].light, dark: textSemantics['state-info-bold'].dark }, | ||
'text-disabled': { light: textSemantics['state-disabled'].light, dark: textSemantics['state-disabled'].dark }, | ||
|
||
'icon-default': { light: iconSemantics['primary'].light, dark: iconSemantics['primary'].dark }, | ||
'icon-success': { light: iconSemantics['state-success-bold'].light, dark: iconSemantics['state-success-bold'].dark }, | ||
'icon-warning': { light: iconSemantics['state-warning-bold'].light, dark: iconSemantics['state-warning-bold'].dark }, | ||
'icon-danger': { light: iconSemantics['state-danger-bold'].light, dark: iconSemantics['state-danger-bold'].dark }, | ||
'icon-info': { light: iconSemantics['state-info-bold'].light, dark: iconSemantics['state-info-bold'].dark }, | ||
'icon-disabled': { light: iconSemantics['state-disabled'].light, dark: iconSemantics['state-disabled'].dark }, | ||
}; |
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