Skip to content
This repository was archived by the owner on Sep 24, 2024. It is now read-only.

Commit f54ebf0

Browse files
SelemondevSelemondev
Selemondev
authored and
Selemondev
committed
Add UButtonGroup with three UButton components
1 parent cc2009e commit f54ebf0

File tree

3 files changed

+41
-5
lines changed

3 files changed

+41
-5
lines changed

packages/nuxt-ui-vue/src/App.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
<template>
55
<div class="grid place-items-center w-full min-h-screen">
6-
<UAvatar src="https://github.com/selemondev.pg" icon="ph:moon" />
6+
<UButtonGroup size="sm" orientation="horizontal">
7+
<UButton icon="ph:music-notes" label="Music" />
8+
<UButton icon="ph:music-notes" label="Music" color="red" />
9+
<UButton icon="ph:music-notes" label="Music" color="red" />
10+
</UButtonGroup>
711
</div>
812
</template>

packages/nuxt-ui-vue/src/components/elements/Button/UButtonGroup.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ import { useVariants } from '../../../composables/useVariants'
77
88
const props = defineProps({
99
...getVariantPropsWithClassesList<UButtonGroup>(),
10-
vertical: {
11-
type: Boolean,
12-
default: false,
10+
orientation: {
11+
type: String,
12+
default: 'horizontal',
1313
},
1414
})
1515
1616
const variant = computed(() => {
1717
const customProps = {
1818
...props,
19-
variant: props.vertical ? 'vertical' : 'horizontal',
19+
variant: props.orientation === 'vertical' ? 'vertical' : 'horizontal',
2020
}
2121
return useVariants<UButtonGroup>(
2222
// eslint-disable-next-line @typescript-eslint/ban-ts-comment

packages/nuxt-ui-vue/tailwind.config.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,41 @@
1+
/* eslint-disable no-unused-expressions */
2+
import tailwindColors from './node_modules/tailwindcss/colors'
3+
4+
const colorSafeList = []
5+
6+
const deprecated = ['lightBlue', 'warmGray', 'trueGray', 'coolGray', 'blueGray']
7+
8+
for (const colorName in tailwindColors) {
9+
if (deprecated.includes(colorName))
10+
continue
11+
12+
const shades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900]
13+
14+
const pallette = tailwindColors[colorName]
15+
16+
if (typeof pallette === 'object') {
17+
shades.forEach((shade) => {
18+
if (shade in pallette) {
19+
colorSafeList.push(`text-${colorName}-${shade}`),
20+
colorSafeList.push(`accent-${colorName}-${shade}`),
21+
colorSafeList.push(`bg-${colorName}-${shade}`),
22+
colorSafeList.push(`hover:enabled:bg-${colorName}-${shade}`),
23+
colorSafeList.push(`focus:bg-${colorName}-${shade}`),
24+
colorSafeList.push(`ring-${colorName}-${shade}`),
25+
colorSafeList.push(`focus:ring-${colorName}-${shade}`),
26+
colorSafeList.push(`border-${colorName}-${shade}`)
27+
}
28+
})
29+
}
30+
}
131
/** @type {import('tailwindcss').Config} */
232
module.exports = {
333
content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
434
darkMode: 'class',
35+
safelist: colorSafeList,
536
theme: {
637
extend: {
38+
colors: tailwindColors,
739
backgroundColor: ['disabled'],
840
textColor: ['disabled'],
941
fontFamily: {

0 commit comments

Comments
 (0)