Skip to content

Commit e8b907e

Browse files
committed
Issue #60: Make the orgs for the various Block brands hover with their associated colors
1 parent 72a4db2 commit e8b907e

File tree

4 files changed

+87
-4
lines changed

4 files changed

+87
-4
lines changed

src/components/block/BrandWall.astro

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,15 @@ const {
1212
brands,
1313
} = Astro.props;
1414
15+
const defaultBgHoverClasses = "hover:bg-gray-100 dark:hover:bg-gray-800";
16+
const defaultForegroundHoverClasses = "group-hover:text-black group-hover:dark:text-white";
17+
1518
export interface Brand {
1619
name: string;
1720
href: string;
1821
iconName: string;
22+
bgHoverClass?: string;
23+
foregroundHoverClass?: string;
1924
}
2025
2126
---
@@ -24,21 +29,21 @@ export interface Brand {
2429
<p>
2530
<slot />
2631
</p>
27-
<div id="projects" class="grid grid-cols-2 sm:grid-cols-2 md:grid-cols-5 lg:grid-cols-5 xl:grid-cols-5 gap-4 sm:gap-6 md:gap-8 py-6 md:py-8">
32+
<div class="grid grid-cols-2 sm:grid-cols-2 md:grid-cols-5 lg:grid-cols-5 xl:grid-cols-5 gap-4 sm:gap-6 md:gap-8 py-6 md:py-8">
2833
{brands.map((brand) => (
2934
<a
3035
href={brand.href}
3136
target="_blank"
3237
rel="noopener noreferrer"
33-
class="group flex flex-col items-center text-center p-3 sm:p-4 md:p-6 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors duration-200 no-underline"
38+
class={`group flex flex-col items-center text-center p-3 sm:p-4 md:p-6 rounded-lg transition-colors duration-200 no-underline ${brand.bgHoverClass ? ('hover:' + brand.bgHoverClass) : defaultBgHoverClasses}`}
3439
>
3540
<div class="mb-2 sm:mb-3 md:mb-4 w-12 h-12 sm:w-14 sm:h-14 md:w-16 md:h-16 lg:w-18 lg:h-18 xl:w-20 xl:h-20 flex items-center justify-center">
3641
<Icon
3742
name={brand.iconName}
38-
class="w-full h-full text-black dark:text-white transition-transform duration-200 group-hover:scale-110"
43+
class={`w-full h-full transition-transform duration-200 group-hover:scale-110 ${brand.foregroundHoverClass ? ('group-hover:' + brand.foregroundHoverClass) : defaultForegroundHoverClasses}`}
3944
/>
4045
</div>
41-
<span class="text-sm sm:text-base md:text-lg font-medium leading-tight">
46+
<span class={`text-sm sm:text-base md:text-lg font-medium leading-tight ${brand.foregroundHoverClass ? ('group-hover:' + brand.foregroundHoverClass) : defaultForegroundHoverClasses}`}>
4247
{brand.name}
4348
</span>
4449
</a>

src/components/blockopensource/github-orgs.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,50 +5,66 @@ export const githubOrganizations: Brand[] = [
55
name: "Block",
66
href: "https://github.com/block",
77
iconName: "block-open-source/block",
8+
bgHoverClass: "bg-square",
9+
foregroundHoverClass: "text-white",
810
},
911
{
1012
name: "Square",
1113
href: "https://github.com/square",
1214
iconName: "block-open-source/square",
15+
bgHoverClass: "bg-square",
16+
foregroundHoverClass: "text-white",
1317
},
1418
{
1519
name: "Square Developers",
1620
href: "https://github.com/Square-Developers",
1721
iconName: "block-open-source/square",
22+
bgHoverClass: "bg-square",
23+
foregroundHoverClass: "text-white",
1824
},
1925
{
2026
name: "Cash App",
2127
href: "https://github.com/cashapp",
2228
iconName: "block-open-source/cashapp",
29+
bgHoverClass: "bg-cashapp",
30+
foregroundHoverClass: "text-white",
2331
},
2432
{
2533
name: "Weebly",
2634
href: "https://github.com/weebly",
2735
iconName: "block-open-source/weebly",
36+
bgHoverClass: "bg-weebly",
37+
foregroundHoverClass: "text-white",
2838
},
2939
{
3040
name: "Afterpay",
3141
href: "https://github.com/afterpay",
3242
iconName: "block-open-source/afterpay",
43+
bgHoverClass: "bg-afterpay",
3344
},
3445
{
3546
name: "TIDAL",
3647
href: "https://github.com/tidal-music",
3748
iconName: "block-open-source/tidal",
49+
bgHoverClass: "bg-tidal",
3850
},
3951
{
4052
name: "Proto",
4153
href: "https://github.com/proto-at-block",
4254
iconName: "block-open-source/proto",
55+
bgHoverClass: "bg-proto",
4356
},
4457
{
4558
name: "c equals",
4659
href: "https://github.com/cequals",
4760
iconName: "block-open-source/c-equals",
61+
bgHoverClass: "bg-proto",
4862
},
4963
{
5064
name: "Spiral",
5165
href: "https://spiral.xyz/",
5266
iconName: "block-open-source/spiral",
67+
bgHoverClass: "bg-spiral",
68+
foregroundHoverClass: "text-white",
5369
},
5470
];

src/styles/global.css

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@
3232
--color-card: hsl(var(--card));
3333
--color-card-foreground: hsl(var(--card-foreground));
3434

35+
/* Block brand colors */
36+
--color-afterpay: #b2fce4;
37+
--color-tidal: #0ec7c7;
38+
--color-proto: #ff5b00;
39+
--color-cashapp: #01c846;
40+
--color-square: #006aff;
41+
--color-block: #000000;
42+
--color-spiral: #ff00ff;
43+
--color-weebly: #4285f4;
44+
3545
--radius-lg: var(--radius);
3646
--radius-md: calc(var(--radius) - 2px);
3747
--radius-sm: calc(var(--radius) - 4px);
@@ -512,4 +522,48 @@
512522
.animate-on-scroll.visible {
513523
opacity: 1;
514524
transform: translateY(0);
525+
}
526+
527+
/* Ensure Tailwind generates hover variants for custom brand colors */
528+
@layer utilities {
529+
.hover\:bg-afterpay:hover {
530+
background-color: var(--color-afterpay);
531+
}
532+
533+
.hover\:bg-tidal:hover {
534+
background-color: var(--color-tidal);
535+
}
536+
537+
.hover\:bg-proto:hover {
538+
background-color: var(--color-proto);
539+
}
540+
541+
.hover\:bg-cashapp:hover {
542+
background-color: var(--color-cashapp);
543+
}
544+
545+
.hover\:bg-square:hover {
546+
background-color: var(--color-square);
547+
}
548+
549+
.hover\:bg-block:hover {
550+
background-color: var(--color-block);
551+
}
552+
553+
.hover\:bg-spiral:hover {
554+
background-color: var(--color-spiral);
555+
}
556+
557+
.hover\:bg-weebly:hover {
558+
background-color: var(--color-weebly);
559+
}
560+
561+
/* Ensure group-hover text color variants are generated */
562+
.group:hover .group-hover\:text-white {
563+
color: white;
564+
}
565+
566+
.group:hover .group-hover\:text-black {
567+
color: black;
568+
}
515569
}

tailwind.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ module.exports = {
5656
DEFAULT: "hsl(var(--card))",
5757
foreground: "hsl(var(--card-foreground))",
5858
},
59+
// Block brand colors
60+
afterpay: "#b2fce4",
61+
tidal: "#0ec7c7",
62+
proto: "#ff5b00",
63+
cashapp: "#01c846",
64+
square: "#006aff",
65+
block: "#000000",
66+
spiral: "#ff00ff",
5967
},
6068
borderRadius: {
6169
lg: "var(--radius)",

0 commit comments

Comments
 (0)