Skip to content

Commit c926dce

Browse files
committed
style: remove default button and link style
1 parent 949c0b9 commit c926dce

5 files changed

Lines changed: 30 additions & 56 deletions

File tree

app/assets/main.css

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ html {
154154
-webkit-font-smoothing: antialiased;
155155
-moz-osx-font-smoothing: grayscale;
156156
text-rendering: optimizeLegibility;
157-
scroll-padding-top: 5rem; /* Offset for fixed header - otherwise anchor headers are cutted */
157+
scroll-padding-top: 5rem;
158+
/* Offset for fixed header - otherwise anchor headers are cutted */
158159
}
159160

160161
/*
@@ -179,42 +180,11 @@ body {
179180
line-height: 1.6;
180181
}
181182

182-
/* Default link styling for accessibility on dark background */
183-
a {
184-
color: var(--fg);
185-
text-decoration: underline;
186-
text-underline-offset: 3px;
187-
text-decoration-color: var(--fg-subtle);
188-
transition:
189-
color 0.2s ease,
190-
text-decoration-color 0.2s ease;
191-
}
192-
193-
a:hover {
194-
color: var(--accent);
195-
text-decoration-color: var(--accent);
196-
}
197-
198-
a:focus-visible {
199-
outline: 2px solid var(--border);
200-
outline-offset: 2px;
201-
border-radius: 2px;
202-
}
203-
204183
/* Reset dd margin (browser default is margin-left: 40px) */
205184
dd {
206185
margin: 0;
207186
}
208187

209-
/* Reset button styles */
210-
button {
211-
background: transparent;
212-
border: none;
213-
cursor: pointer;
214-
font: inherit;
215-
padding: 0;
216-
}
217-
218188
/* Selection */
219189
::selection {
220190
background-color: var(--fg-muted);

app/components/Button/Base.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ defineExpose({
2121
<template>
2222
<button
2323
ref="el"
24-
class="inline-flex gap-x-1 items-center justify-center px-4 py-2 font-mono text-sm border border-border rounded-md transition-all duration-200 focus-ring active:scale-98 disabled:(opacity-40 cursor-not-allowed)"
24+
class="inline-flex gap-x-1 items-center justify-center px-4 py-2 font-mono text-sm border border-border rounded-md transition-all duration-200 disabled:(opacity-40 cursor-not-allowed)"
2525
:class="[
2626
variant === 'primary'
2727
? 'text-bg bg-fg hover:enabled:(bg-fg/90)'

app/components/Button/Link.vue

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
11
<script setup lang="ts">
22
import type { NuxtLinkProps } from '#app'
33
4-
const props = defineProps<
5-
{
6-
/** Disabled links will be displayed as plain text */
7-
disabled?: boolean
8-
/**
9-
* `type` should never be used, because this will always be a link.
10-
*
11-
* If you want a button use `TagButton` instead.
12-
* */
13-
type?: never
14-
} &
15-
/** This makes sure the link always has either `to` or `href` */
16-
(Required<Pick<NuxtLinkProps, 'to'>> | Required<Pick<NuxtLinkProps, 'href'>>) &
17-
NuxtLinkProps
18-
>()
4+
const props = withDefaults(
5+
defineProps<
6+
{
7+
/** Disabled links will be displayed as plain text */
8+
disabled?: boolean
9+
/**
10+
* `type` should never be used, because this will always be a link.
11+
*
12+
* If you want a button use `TagButton` instead.
13+
* */
14+
type?: never
15+
variant?: 'primary' | 'secondary'
16+
} &
17+
/** This makes sure the link always has either `to` or `href` */
18+
(Required<Pick<NuxtLinkProps, 'to'>> | Required<Pick<NuxtLinkProps, 'href'>>) &
19+
NuxtLinkProps
20+
>(),
21+
{ variant: 'secondary' },
22+
)
1923
</script>
2024

2125
<template>
2226
<!-- This is only a placeholder implementation yet. It will probably need some additional styling, but note: A disabled link is just text. -->
2327
<span v-if="disabled" class="opacity-50"><slot /></span>
2428
<NuxtLink
2529
v-else
26-
class="inline-flex items-center justify-center px-4 py-2 font-mono text-sm border border-border rounded-md bg-transparent text-fg transition-all duration-200 hover:(bg-fg hover:text-bg border-fg) focus-ring active:scale-98 disabled:(opacity-40 cursor-not-allowed hover:bg-transparent hover:text-fg)"
27-
:class="
28-
{
29-
'opacity-50 cursor-not-allowed': disabled,
30-
}
31-
"
30+
class="inline-flex gap-x-1 items-center justify-center px-4 py-2 font-mono text-sm border border-border rounded-md transition-all duration-200"
31+
:class="[
32+
variant === 'primary'
33+
? 'text-bg bg-fg hover:enabled:(bg-fg/90)'
34+
: 'bg-transparent text-fg hover:enabled:(bg-fg text-bg border-fg)',
35+
]"
3236
>
3337
<slot />
3438
</NuxtLink>

app/components/Tag/Button.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const props = defineProps<{
1313

1414
<template>
1515
<button
16-
class="inline-flex items-center px-2 py-0.5 text-xs font-mono border rounded transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-fg focus-visible:ring-offset-1 disabled:(opacity-50 cursor-not-allowed)"
16+
class="inline-flex items-center px-2 py-0.5 text-xs font-mono border rounded transition-colors duration-200 disabled:(opacity-50 cursor-not-allowed)"
1717
:class="[
1818
pressed
1919
? 'bg-fg text-bg border-fg hover:enabled:(text-text-bg/50)'

app/components/Tag/Link.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const props = defineProps<
2424
<span v-if="disabled" class="opacity-50"><slot /></span>
2525
<NuxtLink
2626
v-else
27-
class="inline-flex items-center px-2 py-0.5 text-xs font-mono border rounded transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-fg focus-visible:ring-offset-1"
27+
class="inline-flex gap-x-1 items-center justify-center px-2 py-0.5 text-xs font-mono border rounded transition-colors duration-200"
2828
:class="
2929
current
3030
? 'bg-fg text-bg border-fg hover:(text-text-bg/50)'

0 commit comments

Comments
 (0)