Skip to content

Commit d213343

Browse files
authored
feat: add button size variants and improve positioning (#19)
1 parent f311434 commit d213343

File tree

3 files changed

+29
-26
lines changed

3 files changed

+29
-26
lines changed

app/components/ui/UiButton.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ defineProps({
77
variant: {
88
type: String as PropType<'primary' | 'secondary' | 'link' | 'danger'>,
99
default: 'primary'
10+
},
11+
size: {
12+
type: String as PropType<'normal' | 'small'>,
13+
default: 'normal'
1014
}
1115
})
1216
</script>
@@ -15,10 +19,12 @@ defineProps({
1519
<button
1620
:type="type"
1721
:class="{
18-
'p-3 bg-black text-white text-base uppercase cursor-pointer transition-all duration-300 hover:bg-white hover:text-black hover:shadow-inner-black': variant === 'primary',
19-
'py-2 px-4 bg-white text-black border-2 border-black cursor-pointer uppercase hover:bg-black hover:text-white': variant === 'secondary',
20-
'inline-block py-4 px-8 bg-white text-black border-[3px] border-black no-underline uppercase text-lg transition-all duration-300 cursor-pointer hover:bg-black hover:text-white hover:-translate-y-1 hover:shadow-[0_5px_0_#000]': variant === 'link',
21-
'py-2 px-4 bg-red-600 text-white border-2 border-red-600 cursor-pointer uppercase hover:bg-red-700': variant === 'danger'
22+
'bg-black text-white text-base uppercase cursor-pointer transition-all duration-300 hover:bg-white hover:text-black hover:shadow-inner-black': variant === 'primary',
23+
'bg-white text-black border-2 border-black cursor-pointer uppercase hover:bg-black hover:text-white': variant === 'secondary',
24+
'bg-white text-black border-[3px] border-black no-underline uppercase text-lg transition-all duration-300 cursor-pointer hover:bg-black hover:text-white hover:-translate-y-1 hover:shadow-[0_5px_0_#000]': variant === 'link',
25+
'bg-red-600 text-white border-2 border-red-600 cursor-pointer uppercase hover:bg-red-700': variant === 'danger',
26+
'p-3': size === 'normal',
27+
'py-1 px-2 text-sm': size === 'small'
2228
}"
2329
>
2430
<slot />

app/pages/index.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,17 @@ async function submitAnswer() {
134134

135135
<!-- Active Question -->
136136
<div v-if="activeQuestion" class="bg-white border-[4px] border-black p-8">
137-
<div class="flex justify-between items-start mb-8">
138-
<h2 class="text-2xl leading-tight flex-1">{{ activeQuestion.question_text }}</h2>
137+
<div class="flex justify-between items-center mb-4">
138+
<UiButton @click="refreshQuestion" variant="secondary" size="small">
139+
🔄 Refresh
140+
</UiButton>
139141
<div v-if="activeQuestion.is_locked" class="py-2 px-4 bg-black text-white uppercase text-sm whitespace-nowrap">
140142
🔒 Answers Locked
141143
</div>
142144
</div>
145+
<div class="flex justify-between items-start">
146+
<h2 class="text-2xl leading-tight flex-1">{{ activeQuestion.question_text }}</h2>
147+
</div>
143148

144149
<div class="flex flex-col gap-4 mb-5">
145150
<label
@@ -185,11 +190,6 @@ async function submitAnswer() {
185190
</div>
186191
</div>
187192

188-
<div class="flex justify-center gap-5 mt-8">
189-
<UiButton @click="refreshQuestion" variant="link">
190-
Refresh
191-
</UiButton>
192-
</div>
193193
</div>
194194
</div>
195195
</template>

app/pages/results.vue

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,17 @@ function getPercentage(count: number) {
9292
<h2 class="text-3xl mb-4 leading-tight">{{ results.question.question_text }}</h2>
9393
<div class="flex justify-between items-center text-lg">
9494
<span class="font-bold py-2 px-4 bg-gray-100 border-2 border-black">Total Votes: {{ results.totalVotes }}</span>
95-
<span
96-
class="py-2 px-4 border-2 border-black uppercase font-bold"
97-
:class="results.question.is_locked ? 'bg-black text-white' : 'bg-white text-black'"
98-
>
99-
{{ results.question.is_locked ? '🔒 Locked' : '🔓 Open' }}
100-
</span>
95+
<div class="flex items-center gap-4">
96+
<UiButton @click="refreshResults" variant="secondary" size="small">
97+
🔄 Refresh
98+
</UiButton>
99+
<span
100+
class="py-2 px-4 border-2 border-black uppercase font-bold"
101+
:class="results.question.is_locked ? 'bg-black text-white' : 'bg-white text-black'"
102+
>
103+
{{ results.question.is_locked ? '🔒 Locked' : '🔓 Open' }}
104+
</span>
105+
</div>
101106
</div>
102107
</div>
103108

@@ -147,18 +152,10 @@ function getPercentage(count: number) {
147152
<!-- Navigation -->
148153
<div v-if="!isCoreView" class="flex flex-col items-center gap-5 mt-8">
149154
<div class="flex justify-center gap-5">
150-
<UiButton @click="refreshResults" variant="link">
151-
Refresh
152-
</UiButton>
153-
<NuxtLink to="/">
154-
<UiButton variant="link">
155-
← Back to Quiz
156-
</UiButton>
157-
</NuxtLink>
158155
</div>
159156

160157
<!-- Core View Controls -->
161-
<div class="mt-8 p-4 border-t-2 border-black w-full max-w-md flex flex-col items-center gap-4">
158+
<div class="p-4 w-full max-w-md flex flex-col items-center gap-4">
162159
<h3 class="text-lg font-bold">Core View Generator</h3>
163160
<div class="grid grid-cols-2 gap-4 w-full">
164161
<div class="flex flex-col gap-1">

0 commit comments

Comments
 (0)