Skip to content

Commit b5516b8

Browse files
committed
Add gradient support to Logo component and update usage in Header and SearchResults
1 parent b15c6f0 commit b5516b8

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

src/Logo.svelte

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
11
<script lang="ts">
2-
export let fill = 'currentColor';
2+
export let fill = 'gradient'; // Use 'gradient' to enable the gradient
3+
export let gradientColors = ['#4CAF50', '#2196F3']; // Default gradient colors
4+
export let gradientDirection = { x1: '0%', y1: '0%', x2: '100%', y2: '0%' }; // Default direction (horizontal)
35
</script>
46

57
<svg
68
xmlns="http://www.w3.org/2000/svg"
79
xml:space="preserve"
8-
viewBox="0 0 287.36047 410.27499"
10+
viewBox="0 0 287.36 410.27"
911
{...$$restProps}
1012
>
13+
<defs>
14+
<linearGradient
15+
id="gradient"
16+
x1={gradientDirection.x1}
17+
y1={gradientDirection.y1}
18+
x2={gradientDirection.x2}
19+
y2={gradientDirection.y2}
20+
>
21+
<stop offset="0%" stop-color={gradientColors[0]} />
22+
<stop offset="100%" stop-color={gradientColors[1]} />
23+
</linearGradient>
24+
</defs>
1125
<path
12-
{fill}
26+
fill={fill === 'gradient' ? 'url(#gradient)' : fill}
1327
d="M32.775 190.975c-.9 1.7-3.4.8-3.1-1.1l39.7-180.5c.5-2.4 3.6-3.3 5.2-1.3l31.6 37.5c1.4 1.7 1.7 4 .7 6zM4.775 230.575c-.6 2.8-4.7 2.3-4.7-.5v-168c0-2.2 2.6-3.3 4.2-1.9l28.2 25.3c1.3 1.2 1.9 3 1.6 4.8zM280.075 289.975h-57.1c-2.6 0-5 1.4-6.3 3.6l-30.4 48.9c-1.3 2.2-3.7 3.6-6.3 3.6h-65.9c-2.6 0-5-1.4-6.3-3.6l-32.9-57c-1.3-2.2-1.3-5 0-7.3l32.9-57c1.3-2.2 3.7-3.6 6.3-3.6h65.9c2.6 0 5 1.4 6.3 3.6l30.2 47c1.3 2.2 3.7 3.6 6.3 3.6h57.1c5.6 0 9.1-6 6.3-10.9l-63-103.7c-1.3-2.2-3.7-3.6-6.3-3.6l-69.7.3 52.7-90.6c1.3-2.2 1.3-5 0-7.3l-31-53.8c-1.7-2.9-5.9-2.9-7.5 0l-160.4 276.1c-1.3 2.2-1.3 5 0 7.3l69.9 121.1c1.3 2.2 3.7 3.6 6.3 3.6h139.8c2.6 0 5-1.4 6.3-3.6l63.1-105.8c2.8-4.9-.7-10.9-6.3-10.9z"
1428
/>
1529
</svg>

src/lib/SearchResults.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
on:click={onSelected.bind({}, node)}
3636
>
3737
<div class="typeIcon">
38-
<Logo height="1.5rem" />
38+
<Logo height="1.5rem" fill="currentColor" />
3939
<div>App</div>
4040
</div>
4141
<div>

src/routes/Header.svelte

+13-2
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,13 @@
242242
<div class="header-content">
243243
<div class="header-left">
244244
<a href="/" class="logo">
245-
<Logo height="2rem" />
246-
Console
245+
<Logo
246+
height="2rem"
247+
fill="gradient"
248+
gradientColors={['var(--active-color)', '#ffffff']}
249+
gradientDirection={{ x1: '0%', y1: '100%', x2: '100%', y2: '0%' }}
250+
/>
251+
<span class="nais-console">Nais Console</span>
247252
</a>
248253
<div class="search">
249254
<Search
@@ -428,4 +433,10 @@
428433
.cap a {
429434
color: var(--a-text-on-inverted);
430435
}
436+
.nais-console {
437+
background: linear-gradient(to left, var(--active-color), #ffffff);
438+
background-clip: text;
439+
-webkit-background-clip: text;
440+
-webkit-text-fill-color: transparent;
441+
}
431442
</style>

0 commit comments

Comments
 (0)