Skip to content

Commit 7ca5a8b

Browse files
committed
minor changes
1 parent 50a0e1a commit 7ca5a8b

2 files changed

Lines changed: 54 additions & 33 deletions

File tree

components/CustomSwatch.tsx

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ import {
1919
import styles from "./CustomSwatch.module.css";
2020
import { classNames } from "@utils/classNames";
2121
import { useTheme } from "next-themes";
22-
import { Cross2Icon, InfoCircledIcon } from "@radix-ui/react-icons";
22+
import { Cross2Icon, FaceIcon, InfoCircledIcon } from "@radix-ui/react-icons";
2323
import { copy } from "../utils/clipboard";
24+
import { Avatar } from "radix-ui";
2425

2526
const brightColors = ["amber", "yellow", "lime", "mint", "sky"];
2627

@@ -32,6 +33,10 @@ interface CustomSwatchProps extends React.ComponentPropsWithoutRef<"button"> {
3233
hexA: string;
3334
p3: string;
3435
p3A: string;
36+
avatar: string;
37+
name: string;
38+
role: string;
39+
3540
}
3641

3742
export const CustomSwatch = ({
@@ -42,6 +47,9 @@ export const CustomSwatch = ({
4247
hexA,
4348
p3,
4449
p3A,
50+
avatar,
51+
name,
52+
role,
4553
style,
4654
...props
4755
}: CustomSwatchProps) => {
@@ -65,6 +73,8 @@ export const CustomSwatch = ({
6573
)}
6674
{...props}
6775
>
76+
77+
6878
<span style={{ backgroundColor: cssVariable, ...style }}>
6979
<VisuallyHidden>
7080
{scale} {step}
@@ -91,12 +101,17 @@ export const CustomSwatch = ({
91101
width: "100%",
92102
height: "100%",
93103
backgroundColor: cssVariable,
104+
backgroundImage: `url(${avatar})`,
105+
backgroundSize: "cover",
106+
backgroundPosition: "center",
107+
borderRadius: 6,
94108
}}
95109
/>
110+
96111
</Box>
97112

98113
<Heading as="h3" size="3" trim="both" my="4">
99-
{friendlyColorName}
114+
{name}
100115
</Heading>
101116

102117
<Grid
@@ -106,25 +121,11 @@ export const CustomSwatch = ({
106121
gapX="5"
107122
>
108123
<Text color="gray" size="2">
109-
Usage
124+
Role
110125
</Text>
111126
<Box mb={{ initial: "3", xs: "0" }}>
112127
<Text size="2">
113-
{["1", "2"].includes(step) && "Backgrounds"}
114-
{["3", "4", "5"].includes(step) && "Interactive components"}
115-
{["6", "7"].includes(step) && "Borders and separators"}
116-
{["8"].includes(step) &&
117-
isGray &&
118-
"Borders, focus rings, disabled text"}
119-
{["8"].includes(step) && !isGray && "Borders, focus rings"}
120-
{["9", "10"].includes(step) &&
121-
isGray &&
122-
"Solid backgrounds, disabled text"}
123-
{["9", "10"].includes(step) &&
124-
!isGray &&
125-
"Solid backgrounds, buttons"}
126-
{["11"].includes(step) && "Secondary text, links"}
127-
{["12"].includes(step) && "High-contrast text"}
128+
{role}
128129
</Text>
129130
</Box>
130131

pages/developer/custom.tsx

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -338,29 +338,35 @@ export default function Page() {
338338
12
339339
</ColorStepLabel>
340340

341-
{Array.from({ length: 12 }, (_, i) => i + 1).map((step, i) => (
341+
{peopleData.map((person, i) => (
342342
<CustomSwatch
343-
key={step}
344-
scale={accent === "custom" ? "accent" : accent}
345-
step={step.toString()}
346-
cssVariable={`var(--${accent}-${step})`}
347-
hex={result.accentScale[i].toUpperCase()}
348-
hexA={result.accentScaleAlpha[i].toUpperCase()}
349-
p3={result.accentScaleWideGamut[i]}
350-
p3A={result.accentScaleAlphaWideGamut[i]}
343+
key={person.id}
344+
scale="gray"
345+
step={(i + 1).toString()}
346+
cssVariable={`var(--gray-${i + 1})`}
347+
hex={result.grayScale[i]?.toUpperCase()}
348+
hexA={result.grayScaleAlpha[i]?.toUpperCase()}
349+
p3={result.grayScaleWideGamut[i]}
350+
p3A={result.grayScaleAlphaWideGamut[i]}
351+
avatar={person.avatar}
352+
name={person.name}
353+
role={person.role}
351354
/>
352355
))}
353356

354-
{Array.from({ length: 12 }, (_, i) => i + 1).map((step, i) => (
357+
{peopleData.map((person, i) => (
355358
<CustomSwatch
356-
key={step}
359+
key={person.id}
357360
scale="gray"
358-
step={step.toString()}
359-
cssVariable={`var(--gray-${step})`}
360-
hex={result.grayScale[i].toUpperCase()}
361-
hexA={result.grayScaleAlpha[i].toUpperCase()}
361+
step={(i + 1).toString()}
362+
cssVariable={`var(--gray-${i + 1})`}
363+
hex={result.grayScale[i]?.toUpperCase()}
364+
hexA={result.grayScaleAlpha[i]?.toUpperCase()}
362365
p3={result.grayScaleWideGamut[i]}
363366
p3A={result.grayScaleAlphaWideGamut[i]}
367+
avatar={person.avatar}
368+
name={person.name}
369+
role={person.role}
364370
/>
365371
))}
366372
</Grid>
@@ -389,6 +395,20 @@ interface ToDoList {
389395
onItemsChange: (items: ToDoItem[]) => void;
390396
}
391397

398+
const peopleData = [
399+
{ id: 1, name: "Sanjib Narzary", role: "Research and Development", avatar: "https://www.cit.ac.in/uploads/users/images/1755229478.jpg" },
400+
{ id: 2, name: "Rahul Singh", role: "Research and Development", avatar: "/avatars/rahul.png" },
401+
{ id: 3, name: "Priya Das", role: "Engineering and Technology", avatar: "/avatars/priya.png" },
402+
{ id: 4, name: "Amitabh Roy", role: "Engineering and Technology", avatar: "/avatars/amitabh.png" },
403+
{ id: 5, name: "Sneha Patil", role: "Students and Pioneers", avatar: "/avatars/sneha.png" },
404+
{ id: 6, name: "Vikram Joshi", role: "Students and Pioneers", avatar: "/avatars/vikram.png" },
405+
{ id: 7, name: "Rituparna Barman", role: "Management", avatar: "/avatars/rituparna.png" },
406+
{ id: 8, name: "Manoj Kumar", role: "Management", avatar: "/avatars/manoj.png" },
407+
{ id: 9, name: "Suman Deka", role: "Supporting Staff", avatar: "/avatars/suman.png" },
408+
{ id: 10, name: "Geeta Devi", role: "Supporting Staff", avatar: "/avatars/geeta.png" },
409+
{ id: 11, name: "Arjun Nath", role: "Supporting Staff", avatar: "/avatars/arjun.png" },
410+
{ id: 12, name: "Meera Jain", role: "Supporting Staff", avatar: "/avatars/meera.png" },
411+
];
392412
const ToDoList = ({ items, onItemsChange }: ToDoList) => {
393413
return (
394414
<Flex gap="2" direction="column">

0 commit comments

Comments
 (0)