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 (#472)
Here's another option for styling deployment names with tailwind colors. We can adjust this table as needed if we want/need more options. Also, added some reusable card stuff to make sure the colors stay somewhat consistent across the console. ![Screenshot 2023-10-10 at 9 42 27 AM](https://github.com/TBD54566975/ftl/assets/51647/9451fca9-51ad-45c6-94be-1160c12f1d2c) ![Screenshot 2023-10-10 at 9 42 32 AM](https://github.com/TBD54566975/ftl/assets/51647/d9b0b4e7-021f-4aec-b0fe-4c2e038575e2) ![Screenshot 2023-10-10 at 9 42 39 AM](https://github.com/TBD54566975/ftl/assets/51647/f99e5fcf-276c-4a51-a3ba-5f3b6d0e7641) ![Screenshot 2023-10-10 at 9 42 42 AM](https://github.com/TBD54566975/ftl/assets/51647/478eb74b-9379-406f-8e1e-237e7d8deb06)
- Loading branch information
1 parent
386356f
commit e238a52
Showing
9 changed files
with
51 additions
and
109 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> | ||
) | ||
} |
13 changes: 2 additions & 11 deletions
13
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