generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: another option for deployment name colors
- Loading branch information
1 parent
9731534
commit 7ec7b5c
Showing
9 changed files
with
52 additions
and
110 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
console/client/src/features/deployments/DeploymentCard.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,13 @@ | ||
import { useNavigate } from 'react-router-dom' | ||
import { Card } from '../../components/Card' | ||
import { deploymentTextColor } from './deployment.utils' | ||
|
||
export const DeploymentCard = ({ name, className }: { name: string; className?: string }) => { | ||
const navigate = useNavigate() | ||
return ( | ||
<Card key={name} topBarColor='bg-green-500' className={className} onClick={() => navigate(`/deployments/${name}`)}> | ||
{name} | ||
<p className={`text-xs ${deploymentTextColor(name)}`}>{name}</p> | ||
</Card> | ||
) | ||
} |
15 changes: 3 additions & 12 deletions
15
console/client/src/features/deployments/DeploymentsPage.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
22 changes: 22 additions & 0 deletions
22
console/client/src/features/deployments/deployment.utils.ts
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,22 @@ | ||
import hash from 'fnv1a' | ||
|
||
const colorNames = [ | ||
'text-amber-500 dark:text-amber-400', | ||
'text-blue-500 dark:text-blue-400', | ||
'text-cyan-500 dark:text-cyan-400', | ||
'text-emerald-500 dark:text-emerald-400', | ||
'text-fuchsia-500 dark:text-fuchsia-400', | ||
'text-green-500 dark:text-green-400', | ||
'text-indigo-500 dark:text-indigo-400', | ||
'text-lime-500 dark:text-lime-400', | ||
'text-orange-500 dark:text-orange-400', | ||
'text-pink-500 dark:text-pink-400', | ||
'text-purple-500 dark:text-purple-400', | ||
'text-sky-500 dark:text-sky-400', | ||
'text-slate-500 dark:text-slate-400', | ||
'text-teal-500 dark:text-teal-400', | ||
'text-violet-500 dark:text-violet-400', | ||
'text-yellow-500 dark:text-yellow-400', | ||
] | ||
|
||
export const deploymentTextColor = (name: string) => colorNames[hash(name) % colorNames.length] |
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
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