This commit is contained in:
AntoXa PRO 2023-07-26 14:07:17 +03:00
parent 288c5cbb7e
commit 6179e53af7
10 changed files with 77 additions and 54 deletions

View File

@ -1,13 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
const props = defineProps<{ const props = defineProps<{
type?: string, color?: 'primary' | 'accent' | 'info' | 'success' | 'warning' | 'error'
value?: string value?: string
}>() }>()
</script> </script>
<template> <template>
<div class="ui-alert" :class="props.type"> <div class="ui-alert" :class="props.color">
<span v-if="props.value">{{props.value}}</span> {{ props.value }}
<slot v-if="$slots.default" name="default" /> <slot v-if="$slots.default" name="default" />
</div> </div>
</template> </template>

View File

@ -1,5 +1,4 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue'
import UiIcon from './Icon.vue' import UiIcon from './Icon.vue'
// Props. // Props.
@ -9,19 +8,12 @@ const props = defineProps<{
color?: string color?: string
icon?: any icon?: any
}>() }>()
// Etc.
const cssClass = computed(() => {
let res = ''
if (props.color) res = props.color
return res
})
</script> </script>
<template> <template>
<button class="ui-btn" :class="cssClass" :type="props.type"> <button class="ui-btn" :class="props.color" :type="props.type">
<ui-icon v-if="props.icon" :name="props.icon" /> <ui-icon v-if="props.icon" :name="props.icon" />
<div v-if="props.label" class="label">{{ props.label }}</div> <div v-if="props.label" class="label">{{ props.label }}</div>
<slot name="default" /> <slot v-if="$slots.default" name="default" />
</button> </button>
</template> </template>

View File

@ -79,7 +79,7 @@ const inputHandler = (val: any) => {
@input="inputHandler" @input="inputHandler"
class="input" class="input"
> >
<slot /> <!-- <slot v-if="$slots.default" name="default" /> -->
</select> </select>
<div v-if="props.error" class="message">{{ props.error }}</div> <div v-if="props.error" class="message">{{ props.error }}</div>
</div> </div>

View File

@ -1,5 +1,4 @@
<script setup lang="ts"> <script setup lang="ts">
import type { PropType } from 'vue'
import { computed } from 'vue' import { computed } from 'vue'
import UiField from './Field.vue' import UiField from './Field.vue'
@ -17,7 +16,7 @@ const displayValue = computed({
</script> </script>
<template> <template>
<ui-field tag="select" class="ui-field-select" v-model="displayValue"> <ui-field tag="select" class="ui-field-select">
<option v-for="opt in props.options" :value="opt.value"> <option v-for="opt in props.options" :value="opt.value">
{{opt.text}} {{opt.text}}
</option> </option>

View File

@ -15,5 +15,6 @@ const options: any[] = [
</script> </script>
<template> <template>
<p>Select gender</p>
<ui-field-select :options="options" class="ui-field-select-gender" /> <ui-field-select :options="options" class="ui-field-select-gender" />
</template> </template>

View File

@ -7,7 +7,7 @@ import UiBtn from './Btn.vue'
// Props. // Props.
const props = defineProps<{ const props = defineProps<{
modelValue: BaseFormModel<any> modelValue?: BaseFormModel<any>
title?: string title?: string
noTitle?: boolean noTitle?: boolean
messages?: TNotificationItem[] messages?: TNotificationItem[]

View File

@ -1,14 +1,14 @@
export { default as UiBtn } from './Btn.vue'
export { default as UiAlert } from './Alert.vue'
export { default as UiField } from './Field.vue' export { default as UiField } from './Field.vue'
export { default as UiFieldText } from './FieldText.vue' export { default as UiFieldText } from './FieldText.vue'
export { default as UiFieldTextArea } from './FieldTextArea.vue'
export { default as UiFieldPassword } from './FieldPassword.vue' export { default as UiFieldPassword } from './FieldPassword.vue'
export { default as UiFieldNumber } from './FieldNumber.vue' export { default as UiFieldNumber } from './FieldNumber.vue'
export { default as UiFieldPhone } from './FieldPhone.vue' export { default as UiFieldPhone } from './FieldPhone.vue'
export { default as UiFieldDate } from './FieldDate.vue' export { default as UiFieldDate } from './FieldDate.vue'
export { default as UiFieldTextArea } from './FieldTextArea.vue'
export { default as UiFieldCheckbox } from './FieldCheckbox.vue' export { default as UiFieldCheckbox } from './FieldCheckbox.vue'
export { default as UiFieldSelect } from './FieldSelect.vue' export { default as UiFieldSelect } from './FieldSelect.vue'
export { default as UiFieldSelectGender } from './FieldSelectGender.vue' export { default as UiFieldSelectGender } from './FieldSelectGender.vue'
export { default as UiBtn } from './Btn.vue'
export { default as UiAlert } from './Alert.vue'
export { default as UiIcon } from './Icon.vue' export { default as UiIcon } from './Icon.vue'
export { default as UiForm } from './Form.vue' export { default as UiForm } from './Form.vue'

View File

@ -2,8 +2,7 @@ body
@apply text-dark @apply text-dark
* *
@apply text-base @apply text-base
.title
@apply mb-4
h1 h1
@apply text-xl md:text-2xl font-bold @apply text-xl md:text-2xl font-bold
h2 h2
@ -13,9 +12,17 @@ body
h4 h4
@apply text-sm md:text-base font-bold @apply text-sm md:text-base font-bold
p
&:not(:last-child)
@apply mb-4
.title
@apply mb-4
.ui .ui
&-btn, &-btn,
&-field .input &-field .input
@apply outline-none
@apply h-[38px] text-base @apply h-[38px] text-base
&-btn &-btn
@ -45,6 +52,11 @@ body
.input .input
@apply min-h-[80px] @apply min-h-[80px]
&-alert
@apply border p-2
&:not(:last-child)
@apply mb-2
&-icon &-icon
@apply block w-[24px] @apply block w-[24px]

View File

@ -1,30 +1,45 @@
.ui .ui
&-btn
@apply outline-none
&:hover:not(:active)
@apply bg-opacity-80
&-btn,
&-alert
@apply bg-white
&.primary
@apply bg-primary border-primary text-white
&.accent
@apply bg-accent border-accent text-white
&.info
@apply bg-info border-info text-white
&.success
@apply bg-success border-success text-white
&.warning
@apply bg-warning border-warning text-white
&.error
@apply bg-error border-error text-white
&.dark
@apply bg-dark border-dark text-white
&.light
@apply bg-light
&:disabled
@apply text-white bg-light border-light
&-field &-field
&.disabled
.input
@apply bg-light/10 text-dark/60
&.error &.error
.label, .label,
.input, .input,
.message .message
@apply text-error border-error @apply text-error border-error
&-btn &.disabled
&.primary .input
@apply bg-primary text-white @apply bg-light/10 text-dark/60
&.accent &-field .input
@apply bg-accent text-white @apply bg-white dark:bg-white/10
&.dark
@apply bg-dark text-white
&.light
@apply bg-light text-white
&.error
@apply bg-error text-white
&.success
@apply bg-success text-white
&:disabled
@apply text-white bg-light border-light
&-btn, &-btn,
&-alert,
&-field .input &-field .input
@apply rounded @apply rounded
&-field .input
@apply bg-white

View File

@ -6,11 +6,15 @@ const config: Config = {
extend: { extend: {
colors: { colors: {
primary: '#3c87a4', primary: '#3c87a4',
accent: '#f00000', accent: '#ab6dfd',
dark: '#363636', dark: '#363636',
light: '#cdcdcd', light: '#f1f1f1',
error: '#f00000',
success: '#07b859' info: '#2196f3',
warning: '#ff9800',
success: '#2dd633',
error: '#f00000'
}, },
container: { container: {
center: true, center: true,