Skip to content

update class tutorial #1063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
more
  • Loading branch information
Rich-Harris committed Dec 23, 2024
commit b16e367fe3494ec31c17e3352887d385d8fe8b6b
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<!-- creative commons BY-NC http://www.pngall.com/kitten-png/download/7247 -->
<img
class:curious={hereKitty}
class={{ curious: hereKitty }}
alt="Kitten wants to know what's going on"
src={kitten}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<!-- creative commons BY-NC http://www.pngall.com/kitten-png/download/7247 -->
<img
class:curious={hereKitty}
class={{ curious: hereKitty }}
alt="Kitten wants to know what's going on"
src={kitten}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}
</script>

<button class:expanded onclick={toggle}>{name}</button>
<button class={{ expanded }} onclick={toggle}>{name}</button>

{#if expanded}
<ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
</script>

<button class:expanded onclick={toggle}>{name}</button>
<button class={{ expanded }} onclick={toggle}>{name}</button>

{#if expanded}
<ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</script>

<nav
class:has-color={!!page.data.color}
class={[page.data.color && 'has-color']}
style:background={page.data.color ?? 'var(--bg-2)'}
>
<a href="/">home</a>
Expand All @@ -21,4 +21,4 @@
nav.has-color a {
color: white;
}
</style>
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</script>

<nav
class:has-color={!!page.data.color}
class={[page.data.color && 'has-color']}
style:background={page.data.color ?? 'var(--bg-2)'}
>
<a href="/">home</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ We can now use the `component` returned from these `load` functions like any oth
```svelte
/// file: src/routes/+layout.svelte
<nav
class:has-color={!!page.data.color}
class={[page.data.color && 'has-color']}
style:background={page.data.color ?? 'var(--bg-2)'}
>
<a href="/">home</a>
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy