Skip to content

Commit cf65ec4

Browse files
authored
Merge pull request #12505 from Turbo87/svelte-svgs
svelte: Use `@poppanator/sveltekit-svg` for inline SVG support
2 parents 7eaaf73 + 8b94a80 commit cf65ec4

File tree

6 files changed

+97
-6
lines changed

6 files changed

+97
-6
lines changed

pnpm-lock.yaml

Lines changed: 86 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

svelte/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@eslint/compat": "2.0.0",
2020
"@eslint/js": "9.39.1",
2121
"@ianvs/prettier-plugin-sort-imports": "4.7.0",
22+
"@poppanator/sveltekit-svg": "^6.0.1",
2223
"@sveltejs/adapter-static": "3.0.10",
2324
"@sveltejs/kit": "2.49.2",
2425
"@sveltejs/vite-plugin-svelte": "6.2.1",

svelte/src/app.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import '@poppanator/sveltekit-svg/dist/svg.d.ts';
2+
13
// See https://svelte.dev/docs/kit/types#app.d.ts
24
// for information about these interfaces
35
declare global {

svelte/src/lib/assets/lock.svg

Lines changed: 3 additions & 0 deletions
Loading

svelte/src/lib/components/Header.svelte

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { resolve } from '$app/paths';
33
44
import logo from '$lib/assets/cargo.png';
5+
import LockIcon from '$lib/assets/lock.svg?component';
56
67
// TODO: import ColorSchemeMenu from './ColorSchemeMenu.svelte';
78
// TODO: import Dropdown from './Dropdown.svelte';
@@ -10,7 +11,6 @@
1011
// TODO: import UserAvatar from './UserAvatar.svelte';
1112
1213
// TODO: import session service
13-
// TODO: import lock icon SVG
1414
1515
interface Props {
1616
hero?: boolean;
@@ -57,7 +57,7 @@
5757
<!-- <Dropdown data-test-user-menu> ... </Dropdown> -->
5858
<!-- {:else} -->
5959
<button type="button" class="login-button button-reset" data-test-login-button>
60-
<!-- TODO: add lock icon -->
60+
<LockIcon />
6161
Log in with GitHub
6262
</button>
6363
<!-- {/if} -->
@@ -245,13 +245,11 @@
245245
*/
246246
}
247247
248-
/* TODO: uncomment when lock icon is added
249-
.login-icon {
248+
.login-button :global(svg) {
250249
width: 1em;
251250
margin-right: var(--space-2xs);
252251
opacity: 0.5;
253252
}
254-
*/
255253
256254
/* TODO: uncomment when UserAvatar is implemented
257255
.avatar {

svelte/vite.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import svg from '@poppanator/sveltekit-svg';
12
import { sveltekit } from '@sveltejs/kit/vite';
23
import { playwright } from '@vitest/browser-playwright';
34
import { defineConfig } from 'vitest/config';
45

56
export default defineConfig({
6-
plugins: [sveltekit()],
7+
plugins: [sveltekit(), svg()],
78

89
test: {
910
expect: { requireAssertions: true },

0 commit comments

Comments
 (0)