Skip to content
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

tab styles #1132

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
33 changes: 33 additions & 0 deletions src/lib/Tabs.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<div class="tabs grit">
<slot />
</div>

<style>
:global {
.tabs {
margin-bottom: 1rem;
display: flex;
gap: 20px;
/* background: var(--bg-1); */
--border-size: 5px;
border-bottom: var(--border-size) solid var(--primary);
/* padding: 10px 10px 0 10px; */
& > a {
padding: 10px 1rem;
border-radius: var(--brad) var(--brad) 0 0;
font-weight: 900;
}
a:hover {
background: var(--bg-1);
}
a.active {
text-decoration: none;
background: var(--primary);
position: relative;
}
& :global(a) {
color: var(--fg);
}
}
}
</style>
30 changes: 7 additions & 23 deletions src/routes/shows/[show_number]/[slug]/[[tab]]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import NewsletterForm from '$lib/NewsletterForm.svelte';
import Transcript from '$lib/transcript/Transcript.svelte';
import ListenLinks from '$lib/ListenLinks.svelte';
import { json } from 'stream/consumers';
import Tabs from '$lib/Tabs.svelte';
export let data;
$: ({ show } = data);

Expand Down Expand Up @@ -72,21 +74,18 @@
</div>
</div>

<div class="tabs">
<Tabs>
<a
data-sveltekit-noscroll
class:active={decodeURIComponent($page.url.pathname) ===
`/shows/${$page.params.show_number}/${$page.params.slug}`}
class:active={!$page.params.tab}
href="/shows/{$page.params.show_number}/{$page.params.slug}">Show Notes</a
>
<a
class:active={$page.url.pathname.includes(
`/shows/${$page.params.show_number}/${$page.params.slug}/transcript`
)}
class:active={$page.params.tab === 'transcript'}
data-sveltekit-noscroll
href="/shows/{$page.params.show_number}/{$page.params.slug}/transcript">Transcript</a
>
</div>
</Tabs>

<!-- I don't feel great about this one, but it's hard, because these are click targets on show notes coming in from markdown -->
<!-- I have no idea how we would make those timestamps into click targets correctly, maybe we can dynamically add role="button" -->
Expand Down Expand Up @@ -208,28 +207,13 @@
--max-font-size: 15rem;
font-size: clamp(1.5rem, 45cqw, var(--max-font-size));
font-weight: 900;
color: var(--yellow);
color: var(--primary);
line-height: 1;
transform: rotate(-2deg);
z-index: 0;
& ~ * {
position: relative;
}
}
.tabs {
margin-bottom: 1rem;
display: flex;
gap: 20px;
a {
color: var(--fg);
&.active,
&:hover {
color: var(--color-sheet);
text-decoration: underline;
text-decoration-color: var(--primary);
text-decoration-thickness: 2px;
}
}
}
}
</style>
7 changes: 6 additions & 1 deletion src/styles/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@
h2,h3 {
font-size: var(--font-size-lg);
}
ul {
padding-left: 20px;
}
}

html {
Expand Down Expand Up @@ -189,14 +192,16 @@
}

a[href^='#t='] {
background: var(--bg-2);
background: var(--bg-1);
padding: 4px 6px;
border-bottom: none;
text-decoration: none;
color: var(--color-2);
font-weight: normal;
border-radius: 4px;
position: relative;
font-size: var(--font-size-sm);
font-weight: 900;
@media (--above_med) {
left: -17px;
}
Expand Down