-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #290 from TobiTRy/update--FancyGrid-for-better-usage
Update fancy grid for better usage
- Loading branch information
Showing
104 changed files
with
492 additions
and
256 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 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,23 @@ | ||
import { styled } from 'styled-components'; | ||
import { TStyledPrefixAndPicker } from '@/types/TStyledPrefixAndPicker'; | ||
|
||
import { TColoredText } from './TColoredText.model'; | ||
import { TTheme } from '@/types/TTheme'; | ||
import { getBackgroundColor } from '@/design/designFunctions/colorCalculatorForComponent'; | ||
import { simpleColorTransition } from '@/design/designFunctions/simpleColorTransition'; | ||
|
||
type TStyledItem = TStyledPrefixAndPicker<TColoredText, 'layer' | 'themeType' | 'hoverLayer' | 'externalStyle'>; | ||
export const StyledItem = styled.span<TStyledItem & { theme: TTheme }>` | ||
* { | ||
color: ${({ theme, $themeType = 'secondary', $layer = 0 }) => getBackgroundColor({ theme, $themeType, $layer })}; | ||
&:hover { | ||
color: ${({ theme, $themeType = 'secondary', $hoverLayer = 2 }) => | ||
getBackgroundColor({ theme, $themeType, $layer: $hoverLayer })}; | ||
} | ||
${simpleColorTransition} | ||
${({ $externalStyle }) => $externalStyle} | ||
} | ||
`; |
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,14 @@ | ||
import { TDynamicElement } from '@/types/TDynamicElement'; | ||
import { StyledItem } from './ColoredText.style'; | ||
import { TColoredText } from './TColoredText.model'; | ||
import { ElementType } from 'react'; | ||
|
||
export default function ColoredText<T extends ElementType>(props: TColoredText & TDynamicElement<T>) { | ||
const { as, children, themeType, layer, externalStyle } = props; | ||
|
||
return ( | ||
<StyledItem as={as} $themeType={themeType} $layer={layer} $externalStyle={externalStyle}> | ||
{children} | ||
</StyledItem> | ||
); | ||
} |
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,11 @@ | ||
import { TLayer } from '@/types/TLayer'; | ||
import { TUiColorTypes } from '@/types/TUiColorTypes'; | ||
import { CSSProp } from 'styled-components'; | ||
|
||
export type TColoredText = { | ||
children?: React.ReactNode; | ||
themeType?: TUiColorTypes; | ||
layer?: TLayer; | ||
hoverLayer?: TLayer; | ||
externalStyle?: CSSProp; | ||
}; |
73 changes: 73 additions & 0 deletions
73
src/components/atoms/ColoredText/docu/ColoredText.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,73 @@ | ||
// Import necessary dependencies | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
|
||
// Import the component to be tested | ||
import ColoredText from '../ColoredText'; | ||
import templateThemeType from '@/stories/templateSettingsForStorys/templatesForThemeType'; | ||
// Define metadata for the story | ||
const meta = { | ||
title: 'components/atoms/ColoredText', | ||
component: ColoredText, | ||
parameters: { | ||
docs: { | ||
description: { | ||
component: ' A component that displays text with a color based on the themeType and layer properties.', | ||
}, | ||
}, | ||
}, | ||
|
||
// Define arguments for the story | ||
argTypes: { | ||
hoverLayer: { | ||
description: 'The active state of the color indicator', | ||
control: { | ||
type: 'range', | ||
min: 0, | ||
max: 9, | ||
step: 1, | ||
}, | ||
table: { | ||
defaultValue: { summary: 2 }, | ||
}, | ||
}, | ||
...templateThemeType('allThemeTypes', 'secondary', 0), | ||
externalStyle: { | ||
description: 'External style for the component', | ||
control: { | ||
type: 'object', | ||
}, | ||
}, | ||
as: { | ||
description: 'The element type to render (all types)', | ||
control: { | ||
type: 'select', | ||
options: ['span', 'div', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'], | ||
}, | ||
table: { | ||
defaultValue: { summary: 'span' }, | ||
}, | ||
}, | ||
}, | ||
|
||
// Add tags to the story | ||
tags: ['autodocs'], | ||
} satisfies Meta<typeof ColoredText>; | ||
|
||
// Export the metadata | ||
export default meta; | ||
// Define the story object | ||
type Story = StoryObj<typeof meta>; | ||
|
||
// Define the primary story | ||
export const Primary: Story = { | ||
render: (args) => ( | ||
<ColoredText {...args}> | ||
<span>Moooiin</span> | ||
</ColoredText> | ||
), | ||
args: { | ||
themeType: 'primary', | ||
layer: 0, | ||
as: '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,2 @@ | ||
export { default as ColoredText } from './ColoredText'; | ||
export type { TColoredText } from './TColoredText.model'; |
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.