Skip to content
This repository was archived by the owner on Nov 5, 2023. It is now read-only.

Commit 8a2837f

Browse files
authored
Button options (#22)
1 parent 00365ce commit 8a2837f

File tree

5 files changed

+26
-9
lines changed

5 files changed

+26
-9
lines changed

app.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ const fanItems = ref<ActionFanItem<CharacterPose>[]>([
3030
</h2>
3131
<div class="not-prose flex flex-wrap gap-3">
3232
<DBtn>Just Button</DBtn>
33+
<DBtn no-rotate>No Rotate</DBtn>
3334
<DBtn href="https://d0rich.me" target="_blank">Link Button</DBtn>
3435
<DBtn highlight="negative-tile">Default highlight</DBtn>
3536
<DBtn highlight="list-item">List highlight</DBtn>
37+
<DBtn highlight="list-item" color-class="bg-blue-600">Custom color</DBtn>
3638
<DBtn highlight="negative-list-item">List highlight (negative)</DBtn>
3739
</div>
3840
</section>

components/d/Btn.vue

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ const props = defineProps({
1818
},
1919
exact: Boolean,
2020
noPassiveHl: Boolean,
21+
noRotate: Boolean,
2122
tag: {
2223
type: String,
2324
default: 'button'
2425
},
2526
highlight: {
2627
type: String as () => HighlightVariant,
2728
default: undefined
28-
}
29+
},
30+
colorClass: [String, Object as () => Record<string, boolean>]
2931
})
3032
3133
const currentComponent = computed(() => {
@@ -35,11 +37,19 @@ const currentComponent = computed(() => {
3537
</script>
3638

3739
<template>
38-
<Component :is="currentComponent" class="d-btn" v-bind="props">
40+
<Component
41+
:is="currentComponent"
42+
class="d-btn"
43+
:class="{
44+
'-rotate-6': !noRotate
45+
}"
46+
v-bind="props"
47+
>
3948
<DWrapFocusHighlight
4049
:variant="highlight"
4150
:link-exact="exact"
4251
:no-passive-link="noPassiveHl"
52+
:color-class="colorClass"
4353
>
4454
<slot />
4555
</DWrapFocusHighlight>
@@ -48,6 +58,6 @@ const currentComponent = computed(() => {
4858

4959
<style>
5060
.d-btn {
51-
@apply font-extrabold uppercase -rotate-6 select-none relative inline-block;
61+
@apply font-extrabold uppercase select-none relative inline-block;
5262
}
5363
</style>

components/d/wrap/FocusHighlight.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ const props = defineProps({
2020
tag: {
2121
type: String,
2222
default: 'div'
23+
},
24+
colorClass: {
25+
type: [String, Object as () => Record<string, boolean>],
26+
default: 'bg-red-600'
2327
}
2428
})
2529
@@ -49,6 +53,7 @@ const currentComponent = computed(() => {
4953
<div
5054
v-else-if="variant === 'list-item'"
5155
class="d-focus-hl__hl--list-item"
56+
:class="colorClass"
5257
/>
5358
<div
5459
v-else-if="variant === 'negative-list-item'"
@@ -119,10 +124,10 @@ const currentComponent = computed(() => {
119124
@keyframes hl--negative-tile-animation {
120125
0%,
121126
100% {
122-
transform: skew(0deg) rotate(12deg);
127+
transform: skew(0deg) rotate(6deg);
123128
}
124129
50% {
125-
transform: skew(-40deg) rotate(-28deg);
130+
transform: skew(-40deg) rotate(-6deg) scaleX(0.8);
126131
}
127132
}
128133
</style>
@@ -140,7 +145,7 @@ const currentComponent = computed(() => {
140145
left: 0;
141146
content: '';
142147
clip-path: polygon(1rem 0, 0% 100%, 100% 50%);
143-
@apply absolute bg-red-600 transition-all -z-10;
148+
@apply absolute transition-all -z-10;
144149
}
145150
146151
.d-focus-hl:hover > .d-focus-hl__hl--list-item,

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@d0rich/nuxt-design-system",
3-
"version": "0.5.4",
3+
"version": "0.5.5",
44
"main": "./nuxt.config.ts",
55
"description": "🖼️ Design system for d0rich's projects based on Nuxt 3 and Tailwind CSS",
66
"keywords": [

0 commit comments

Comments
 (0)