|
| 1 | +--- |
| 2 | +import { Icon } from "astro-iconify"; |
| 3 | +
|
| 4 | +export interface LogoItem { |
| 5 | + title: string; |
| 6 | + icon?: string; |
| 7 | + href?: string; |
| 8 | + alt?: string; |
| 9 | +} |
| 10 | +
|
| 11 | +interface Props { |
| 12 | + title: string; |
| 13 | + logos: LogoItem[]; |
| 14 | + theme?: |
| 15 | + | "purple" |
| 16 | + | "cyan" |
| 17 | + | "green" |
| 18 | + | "blue" |
| 19 | + | "orange" |
| 20 | + | "pink" |
| 21 | + | "red" |
| 22 | + | "yellow"; |
| 23 | +} |
| 24 | +
|
| 25 | +const { title, logos, theme = "purple" } = Astro.props; |
| 26 | +--- |
| 27 | + |
| 28 | +<section class="logo-list not-content" data-theme={theme}> |
| 29 | + <h2>{title}</h2> |
| 30 | + <ul> |
| 31 | + { |
| 32 | + logos.map(({ title, icon, href, alt }) => { |
| 33 | + const content = ( |
| 34 | + <div class="logo-tile"> |
| 35 | + <Icon |
| 36 | + name={icon} |
| 37 | + class="logo-icon" |
| 38 | + aria-label={alt ?? title} |
| 39 | + title={alt ?? title} |
| 40 | + /> |
| 41 | + |
| 42 | + <span>{title}</span> |
| 43 | + </div> |
| 44 | + ); |
| 45 | + |
| 46 | + if (href) { |
| 47 | + return ( |
| 48 | + <li> |
| 49 | + <a href={href} class="logo-link"> |
| 50 | + {content} |
| 51 | + </a> |
| 52 | + </li> |
| 53 | + ); |
| 54 | + } |
| 55 | + |
| 56 | + return <li>{content}</li>; |
| 57 | + }) |
| 58 | + } |
| 59 | + </ul> |
| 60 | +</section> |
| 61 | + |
| 62 | +<style> |
| 63 | + .logo-list { |
| 64 | + margin: 0; |
| 65 | + --theme-color: var(--brand-purple); |
| 66 | + --theme-color-t1: var(--brand-purple--t1); |
| 67 | + } |
| 68 | + |
| 69 | + .logo-list h2 { |
| 70 | + display: flex; |
| 71 | + align-items: center; |
| 72 | + justify-content: center; |
| 73 | + gap: 0.5em; |
| 74 | + margin-bottom: 1.5rem; |
| 75 | + } |
| 76 | + |
| 77 | + .logo-list ul { |
| 78 | + list-style: none; |
| 79 | + padding: 0; |
| 80 | + margin: 0; |
| 81 | + display: grid; |
| 82 | + grid-template-columns: repeat(2, 1fr); |
| 83 | + gap: 1rem; |
| 84 | + } |
| 85 | + |
| 86 | + .logo-list li { |
| 87 | + width: 100%; |
| 88 | + } |
| 89 | + |
| 90 | + .logo-link { |
| 91 | + text-decoration: none; |
| 92 | + color: inherit; |
| 93 | + } |
| 94 | + |
| 95 | + .logo-list[data-theme="purple"] { |
| 96 | + --theme-color: var(--brand-purple); |
| 97 | + --theme-color-t1: var(--brand-purple--t1); |
| 98 | + } |
| 99 | + |
| 100 | + .logo-list[data-theme="cyan"] { |
| 101 | + --theme-color: var(--brand-cyan); |
| 102 | + --theme-color-t1: var(--brand-cyan--t1); |
| 103 | + } |
| 104 | + |
| 105 | + .logo-list[data-theme="green"] { |
| 106 | + --theme-color: var(--brand-green); |
| 107 | + --theme-color-t1: var(--brand-green--t1); |
| 108 | + } |
| 109 | + |
| 110 | + .logo-list[data-theme="blue"] { |
| 111 | + --theme-color: var(--brand-blue); |
| 112 | + --theme-color-t1: var(--brand-blue--t1); |
| 113 | + } |
| 114 | + |
| 115 | + .logo-list[data-theme="orange"] { |
| 116 | + --theme-color: var(--brand-orange); |
| 117 | + --theme-color-t1: var(--brand-orange--t1); |
| 118 | + } |
| 119 | + |
| 120 | + .logo-list[data-theme="pink"] { |
| 121 | + --theme-color: var(--brand-pink); |
| 122 | + --theme-color-t1: var(--brand-pink--t1); |
| 123 | + } |
| 124 | + |
| 125 | + .logo-list[data-theme="red"] { |
| 126 | + --theme-color: var(--brand-red); |
| 127 | + --theme-color-t1: var(--brand-red--t1); |
| 128 | + } |
| 129 | + |
| 130 | + .logo-list[data-theme="yellow"] { |
| 131 | + --theme-color: var(--brand-yellow); |
| 132 | + --theme-color-t1: var(--brand-yellow--t1); |
| 133 | + } |
| 134 | + |
| 135 | + .logo-tile { |
| 136 | + width: 100%; |
| 137 | + border: 1px dotted var(--theme-color-t1); |
| 138 | + border-radius: 12px; |
| 139 | + padding: 1.25rem 1rem; |
| 140 | + min-height: var(--logo-tile-height, 150px); |
| 141 | + display: flex; |
| 142 | + flex-direction: column; |
| 143 | + align-items: center; |
| 144 | + gap: 0.75rem; |
| 145 | + background: color-mix(in srgb, var(--sl-color-bg), transparent 20%); |
| 146 | + transition: |
| 147 | + transform 150ms ease, |
| 148 | + border-color 150ms ease, |
| 149 | + box-shadow 150ms ease; |
| 150 | + } |
| 151 | + |
| 152 | + .logo-link:hover .logo-tile, |
| 153 | + .logo-link:focus-visible .logo-tile { |
| 154 | + transform: translateY(-4px); |
| 155 | + border-color: var(--brand-red); |
| 156 | + box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18); |
| 157 | + } |
| 158 | + |
| 159 | + .logo-tile img { |
| 160 | + width: 56px; |
| 161 | + height: 56px; |
| 162 | + } |
| 163 | + |
| 164 | + .logo-icon { |
| 165 | + width: 56px; |
| 166 | + height: 56px; |
| 167 | + color: var(--theme-color); |
| 168 | + transition: color 150ms ease; |
| 169 | + } |
| 170 | + |
| 171 | + .logo-link:hover .logo-icon, |
| 172 | + .logo-link:focus-visible .logo-icon { |
| 173 | + color: var(--brand-red); |
| 174 | + } |
| 175 | + |
| 176 | + .logo-tile span { |
| 177 | + display: inline-block; |
| 178 | + max-width: 100%; |
| 179 | + text-align: center; |
| 180 | + font-size: 0.95rem; |
| 181 | + line-height: 1.4; |
| 182 | + text-wrap: balance; |
| 183 | + } |
| 184 | + |
| 185 | + :global(:root[data-theme="dark"]) .logo-tile img { |
| 186 | + filter: invert(1); |
| 187 | + } |
| 188 | + |
| 189 | + @media (max-width: 768px) { |
| 190 | + .logo-list ul { |
| 191 | + grid-template-columns: repeat(2, 1fr); |
| 192 | + gap: 0.75rem; |
| 193 | + } |
| 194 | + } |
| 195 | +</style> |
0 commit comments