Skip to content

Commit

Permalink
plasma-website: Color palette [hotfix] (#1304)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yakutoc authored Jul 17, 2024
2 parents a635403 + 7e15fd7 commit 84ee5d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { ShowToastArgs } from '@salutejs/plasma-b2c';
import { IconCopyOutline } from '@salutejs/plasma-icons';
import { ContrastRatioChecker } from 'contrast-ratio-checker';
import { useRouter } from 'next/router';
import _ from 'lodash';

import { convertHexToRgb, paletteColors, checkColor } from '../../utils';

Expand Down Expand Up @@ -212,7 +213,7 @@ export const PaletteColorPage: React.FC<{

const paletteColor = paletteColors[color];
const selectedColor = paletteColor[colorCode];
const colorCodes = Object.keys(paletteColor).reverse();
const colorCodes = Object.keys(_.omit(paletteColor, '50')).reverse();

const rgb = convertHexToRgb(selectedColor);
const colorIndex = colorCodes.findIndex((code) => paletteColor[code] === selectedColor);
Expand All @@ -225,7 +226,7 @@ export const PaletteColorPage: React.FC<{

return (
<ColorWrapper background={selectedColor}>
<Header text={`${color} ${colorCode}`} link="/palette" />
<Header text={`${color} ${colorCode}`} link="/palette/" />
<ColorPalette>
{colorCodes.map((code) => (
<ColorItem
Expand Down
3 changes: 2 additions & 1 deletion website/plasma-website/components/palette/PaletteItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const StyledColorItem = styled.div<{ colors: colorItemType['colors'] }>`

const StyledMask = styled.div`
display: flex;
flex-direction: row-reverse;
width: 100%;
height: 100%;
flex: 1;
Expand Down Expand Up @@ -181,7 +182,7 @@ export const PaletteItem: React.FC<{
<StyledNameColor
className={classes.nameColor}
color={
paletteColor.colors[paletteColor.colors.length - 1 - index].ratio > 3.5
paletteColor.colors[index].ratio > 3.5
? 'rgba(255, 255, 255, 0.56)'
: 'rgba(0, 0, 0, 0.56)'
}
Expand Down

0 comments on commit 84ee5d3

Please sign in to comment.