-
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 #305 from TobiTRy/303-update-to-fit-the-ux
303 update to fit the ux
- Loading branch information
Showing
103 changed files
with
1,197 additions
and
579 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,2 @@ | ||
prefer-workspace-packages=true | ||
legacy-peer-deps=true |
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 |
---|---|---|
@@ -1,95 +1,97 @@ | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
import React from 'react'; | ||
|
||
import styled, { css } from 'styled-components'; | ||
|
||
import { FancyButton } from '@/components/organisms/FancyButton'; | ||
import { TLayer } from '@/types'; | ||
import themeStore from '../../design/theme/themeStore/themeStore'; | ||
import { TTheme } from '@/types/TTheme'; | ||
|
||
export default function ColorGeneratorRoute() { | ||
const theme = themeStore((state) => state.theme); | ||
const switchTheme = themeStore((state) => state.switchTheme); | ||
//get keys of primary | ||
const primaryKeys = Object?.keys(theme?.color.primary); | ||
const accentKeys = Object?.keys(theme?.color.accent); | ||
const secondaryKeys = Object?.keys(theme?.color.secondary); | ||
const infoKeys = Object?.keys(theme?.color.info); | ||
const warningKeys = Object?.keys(theme?.color.warning); | ||
const errorKeys = Object?.keys(theme?.color.error); | ||
const successKeys = Object?.keys(theme?.color.success); | ||
const primaryKeys = Object?.keys(theme.color.primary).map((key) => parseInt(key)); | ||
const accentKeys = Object?.keys(theme.color.accent).map((key) => parseInt(key)); | ||
const secondaryKeys = Object?.keys(theme.color.secondary).map((key) => parseInt(key)); | ||
const infoKeys = Object?.keys(theme.color.info).map((key) => parseInt(key)); | ||
const warningKeys = Object?.keys(theme.color.warning).map((key) => parseInt(key)); | ||
const errorKeys = Object?.keys(theme.color.error).map((key) => parseInt(key)); | ||
const successKeys = Object?.keys(theme.color.success).map((key) => parseInt(key)); | ||
|
||
return ( | ||
<div style={{ display: 'flex' }}> | ||
<div> | ||
{primaryKeys?.map((color, index) => { | ||
return ( | ||
<div | ||
key={index} | ||
style={{ width: '100px', height: '100px', backgroundColor: theme.color.primary[color] }} | ||
></div> | ||
); | ||
})} | ||
</div> | ||
<div> | ||
{accentKeys?.map((color, index) => { | ||
return ( | ||
<div | ||
key={index} | ||
style={{ width: '100px', height: '100px', backgroundColor: theme.color.accent[color] }} | ||
></div> | ||
); | ||
})} | ||
</div> | ||
<div> | ||
{infoKeys?.map((color, index) => { | ||
return ( | ||
<div | ||
key={index} | ||
style={{ width: '100px', height: '100px', backgroundColor: theme.color.accent[color] }} | ||
></div> | ||
); | ||
})} | ||
</div> | ||
<> | ||
<div style={{ display: 'flex' }}> | ||
<FancyButton label="Switch Theme" onClick={() => switchTheme()} /> | ||
|
||
<div> | ||
{secondaryKeys?.map((color, index) => { | ||
return ( | ||
<div | ||
key={index} | ||
style={{ width: '100px', height: '100px', backgroundColor: theme.color.secondary[color] }} | ||
></div> | ||
); | ||
})} | ||
</div> | ||
<div> | ||
{warningKeys?.map((color, index) => { | ||
return ( | ||
<div | ||
key={index} | ||
style={{ width: '100px', height: '100px', backgroundColor: theme.color.warning[color] }} | ||
></div> | ||
); | ||
})} | ||
</div> | ||
<div> | ||
{errorKeys?.map((color, index) => { | ||
return ( | ||
<div | ||
key={index} | ||
style={{ width: '100px', height: '100px', backgroundColor: theme.color.error[color] }} | ||
></div> | ||
); | ||
})} | ||
</div> | ||
<div> | ||
{successKeys?.map((color, index) => { | ||
return ( | ||
<div | ||
key={index} | ||
style={{ width: '100px', height: '100px', backgroundColor: theme.color.success[color] }} | ||
></div> | ||
); | ||
})} | ||
<div> | ||
{primaryKeys?.map((color, index) => { | ||
return ( | ||
<div | ||
key={index} | ||
style={{ width: '100px', height: '100px', backgroundColor: theme.color.primary[color as TLayer] }} | ||
></div> | ||
); | ||
})} | ||
</div> | ||
|
||
<div> | ||
{secondaryKeys?.map((color, index) => { | ||
return ( | ||
<div | ||
key={index} | ||
style={{ width: '100px', height: '100px', backgroundColor: theme.color.secondary[color as TLayer] }} | ||
></div> | ||
); | ||
})} | ||
</div> | ||
<div> | ||
{accentKeys?.map((color, index) => { | ||
return ( | ||
<div | ||
key={index} | ||
style={{ width: '100px', height: '100px', backgroundColor: theme.color.accent[color as TLayer] }} | ||
></div> | ||
); | ||
})} | ||
</div> | ||
<div> | ||
{infoKeys?.map((color, index) => { | ||
return ( | ||
<div | ||
key={index} | ||
style={{ width: '100px', height: '100px', backgroundColor: theme.color.info[color as TLayer] }} | ||
></div> | ||
); | ||
})} | ||
</div> | ||
|
||
<div> | ||
{warningKeys?.map((color, index) => { | ||
return ( | ||
<div | ||
key={index} | ||
style={{ width: '100px', height: '100px', backgroundColor: theme.color.warning[color as TLayer] }} | ||
></div> | ||
); | ||
})} | ||
</div> | ||
<div> | ||
{errorKeys?.map((color, index) => { | ||
return ( | ||
<div | ||
key={index} | ||
style={{ width: '100px', height: '100px', backgroundColor: theme.color.error[color as TLayer] }} | ||
></div> | ||
); | ||
})} | ||
</div> | ||
<div> | ||
{successKeys?.map((color, index) => { | ||
return ( | ||
<div | ||
key={index} | ||
style={{ width: '100px', height: '100px', backgroundColor: theme.color.success[color as TLayer] }} | ||
></div> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
} |
58 changes: 58 additions & 0 deletions
58
src/Routes/MaterialColorGeneratorRoute/MaterialColorGeneratorRoute.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,58 @@ | ||
import { FancyBox } from '@/components/atoms/FancyBox'; | ||
import { Typography } from '@/components/atoms/Typography'; | ||
import { FancyFlexBox } from '@/components/templates/FancyFlexBox'; | ||
import { generateMaterialColorPalette } from '@/design/designFunctions/generateMaterialColorPalette/generateMaterialColorPalette'; | ||
import { hexToHSL } from '@/design/designFunctions/hexToHSL/hexToHSL'; | ||
import { useState } from 'react'; | ||
|
||
export default function MaterialColorGeneratorRoute() { | ||
const [baseColor, setBaseColor] = useState('#f32020'); | ||
const [isDark, setIsDark] = useState(false); | ||
|
||
const palette = generateMaterialColorPalette({ baseHex: baseColor, isLightTheme: !isDark }); | ||
|
||
const getContrastText = (bgColor: string) => { | ||
const { l } = hexToHSL(bgColor); | ||
return l > 60 ? '#000000' : '#FFFFFF'; | ||
}; | ||
|
||
return ( | ||
<FancyBox> | ||
<FancyFlexBox direction="column"> | ||
<Typography variant="bodytextLg">Material Color Palette</Typography> | ||
<button onClick={() => setIsDark(!isDark)}>{isDark ? 'isDark' : 'IsLight'}</button> | ||
</FancyFlexBox> | ||
<FancyBox> | ||
<div> | ||
<input type="color" value={baseColor} onChange={(e) => setBaseColor(e.target.value)} /> | ||
<span>{baseColor}</span> | ||
</div> | ||
|
||
<FancyFlexBox direction="column" align="stretch" justify="center" gap={'sm'}> | ||
{Object.entries(palette).map(([weight, color]) => ( | ||
<FancyBox | ||
themeType="transparent" | ||
borderRadius={'md'} | ||
padding={'sm'} | ||
key={weight} | ||
style={{ | ||
backgroundColor: color, | ||
color: getContrastText(color), | ||
}} | ||
> | ||
<FancyFlexBox justify="space-around" align="center"> | ||
<div className="w-16 font-medium">{weight}</div> | ||
<div>{color.toUpperCase()}</div> | ||
</FancyFlexBox> | ||
</FancyBox> | ||
))} | ||
</FancyFlexBox> | ||
|
||
<div> | ||
<p>Usage in CSS:</p> | ||
<code>{`--color-primary-${isDark ? 'dark' : 'light'}: ${baseColor};`}</code> | ||
</div> | ||
</FancyBox> | ||
</FancyBox> | ||
); | ||
} |
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.