This repository has been archived by the owner on Aug 29, 2023. It is now read-only.
generated from ost-cas-fee-adv-22-23/cas-fee-adv-design-system-tpl
-
Notifications
You must be signed in to change notification settings - Fork 0
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
19 changed files
with
158 additions
and
205 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 |
---|---|---|
|
@@ -14,4 +14,5 @@ export const Link = Template.bind({}); | |
Link.args = { | ||
children: 'Link', | ||
href: '/', | ||
newTab: true, | ||
}; |
This file was deleted.
Oops, something went wrong.
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
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,88 @@ | ||
import React, { FC, ReactNode } from 'react'; | ||
|
||
import { Icon, TIconSize, TIconName } from '../../Atoms/Icon/Icon'; | ||
|
||
/* | ||
* Type | ||
*/ | ||
|
||
type TIconTextSize = keyof typeof IconTextSizeMap; | ||
type TIconTextColor = keyof typeof IconTextColorMap; | ||
|
||
type TIconText = { | ||
/** | ||
* React Children: here most probably text | ||
*/ | ||
children: ReactNode; | ||
|
||
/** | ||
* text size options of this button (S, M, L) | ||
*/ | ||
size?: TIconTextSize; | ||
|
||
/** | ||
* color scheme options of this button (slate, violet, gradient) | ||
*/ | ||
colorScheme: TIconTextColor; | ||
|
||
/** | ||
* icon name to render | ||
*/ | ||
icon: TIconName; | ||
}; | ||
|
||
/* | ||
* Style | ||
*/ | ||
|
||
const IconTextBaseStyle: string[] = ['flex items-center', 'leading-none', 'rounded-full']; | ||
|
||
export const IconTextSizeMap: Record<string, string> = { | ||
S: 'text-sm gap-1 px-2 py-1', | ||
M: 'text-base gap-2 px-3 py-2', | ||
L: 'text-xl gap-2 px-4 py-3', | ||
}; | ||
|
||
export const IconTextColorMap: Record<string, string> = { | ||
slate: 'text-slate-400 hover:text-slate-600 hover:bg-slate-100 ', | ||
violet: 'text-violet-600 hover:text-violet-900 hover:bg-violet-50 ', | ||
pink: ' text-pink-400 hover:text-pink-600 hover:bg-pink-50', | ||
}; | ||
|
||
/** | ||
* IconText component | ||
* | ||
* @param {string} children - React Children: here most probably text | ||
* @param {string} as - HTML tag to render a button (button, a, span) | ||
* @param {string} size - text size options of this button (S, M, L) | ||
* @param {string} colorScheme - color scheme options of this button (slate, violet, gradient) | ||
* @param {string} icon - icon name to render | ||
* | ||
* @example <IconText icon="arrowRight" colorScheme="slate" size="M">IconText</IconText> | ||
* / | ||
/* | ||
* State | ||
*/ | ||
|
||
export const IconText: FC<TIconText> = ({ children = 'IconText', colorScheme = 'slate', size = 'M', icon, ...props }) => { | ||
const styles = [ | ||
...IconTextBaseStyle, | ||
IconTextSizeMap[size], | ||
IconTextColorMap[colorScheme], | ||
'group', | ||
'transition-all duration-300', | ||
]; | ||
|
||
return ( | ||
<span | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
{...(props as any)} | ||
className={styles.join(' ')} | ||
> | ||
<Icon name={icon} size={size as TIconSize} /> | ||
{children} | ||
</span> | ||
); | ||
}; |
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 './IconText'; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,3 +1,9 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
|
||
@layer base { | ||
body { | ||
@apply bg-slate-100 dark:bg-slate-900 text-slate-900 dark:text-slate-100; | ||
} | ||
} |
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
Oops, something went wrong.