brutalism design
This commit is contained in:
@@ -17,15 +17,21 @@ const { version } = useApp()
|
||||
|
||||
<style lang="scss">
|
||||
.app-logo {
|
||||
background-color: var(--ink);
|
||||
padding: var(--space-2);
|
||||
text-align: center;
|
||||
|
||||
&__title {
|
||||
color: var(--primary);
|
||||
font-weight: 700;
|
||||
line-height: 20px;
|
||||
@include font-display-22;
|
||||
|
||||
color: var(--yellow);
|
||||
}
|
||||
|
||||
&__version {
|
||||
font-size: 0.75rem;
|
||||
color: var(--text-muted);
|
||||
@include font-micro;
|
||||
|
||||
color: var(--grey-3);
|
||||
margin-top: var(--space-1);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
50
new-client/src/shared/components/ui/Avatar.vue
Normal file
50
new-client/src/shared/components/ui/Avatar.vue
Normal file
@@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<div class="chad-avatar" v-bind="api.getRootProps()">
|
||||
<span class="chad-avatar__fallback" v-bind="api.getFallbackProps()">{{ fallback }}</span>
|
||||
<img class="chad-avatar__image" :alt="fallback" :src="src" v-bind="api.getImageProps()">
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import * as avatar from '@zag-js/avatar'
|
||||
import { normalizeProps, useMachine } from '@zag-js/vue'
|
||||
import { computed, useId } from 'vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'ChadAvatar',
|
||||
})
|
||||
|
||||
defineProps<{
|
||||
src: string
|
||||
fallback: string
|
||||
size?: 'sm'
|
||||
}>()
|
||||
|
||||
const service = useMachine(avatar.machine, { id: useId() })
|
||||
|
||||
const api = computed(() => avatar.connect(service, normalizeProps))
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.chad-avatar {
|
||||
outline: var(--border-w) solid var(--ink);
|
||||
outline-offset: calc(var(--border-w) * -1);
|
||||
width: 40px;
|
||||
aspect-ratio: 1;
|
||||
|
||||
&__fallback {
|
||||
@include font-label;
|
||||
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
&__image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -2,6 +2,7 @@
|
||||
<button
|
||||
class="chad-button"
|
||||
:data-loading="loading || undefined"
|
||||
:data-disabled="disabled || undefined"
|
||||
:disabled="disabled"
|
||||
:type="type"
|
||||
:data-full="full || undefined"
|
||||
@@ -32,28 +33,43 @@ interface Props {
|
||||
|
||||
<style lang="scss">
|
||||
.chad-button {
|
||||
@include font-display-14;
|
||||
|
||||
border: none;
|
||||
color: var(--bg-dark);
|
||||
border-radius: 12px;
|
||||
padding-inline: 12px;
|
||||
color: var(--ink);
|
||||
padding-inline: var(--space-3);
|
||||
height: 44px;
|
||||
background-color: var(--primary);
|
||||
background-color: var(--yellow);
|
||||
font-weight: 700;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
transition-property: color, background-color;
|
||||
transition-duration: 150ms;
|
||||
transition-timing-function: ease-out;
|
||||
outline: none;
|
||||
outline: var(--border-w) solid var(--ink);
|
||||
outline-offset: calc(var(--border-w) * -1);
|
||||
|
||||
&[data-full] {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&:hover,
|
||||
&:focus,
|
||||
&:focus {
|
||||
background-color: var(--yellow-deep);
|
||||
}
|
||||
|
||||
&:active {
|
||||
background-color: var(--secondary);
|
||||
background-color: var(--ink);
|
||||
color: var(--yellow);
|
||||
}
|
||||
|
||||
&[data-disabled],
|
||||
&[data-loading],
|
||||
&:disabled {
|
||||
cursor: not-allowed;
|
||||
background-color: var(--grey-1);
|
||||
color: var(--grey-3);
|
||||
}
|
||||
|
||||
&[data-loading] {
|
||||
cursor: wait;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
68
new-client/src/shared/components/ui/Card.vue
Normal file
68
new-client/src/shared/components/ui/Card.vue
Normal file
@@ -0,0 +1,68 @@
|
||||
<template>
|
||||
<Component :is="as" class="chad-card">
|
||||
<p v-if="title" class="chad-card__title">
|
||||
{{ title }}
|
||||
</p>
|
||||
|
||||
<div class="chad-card__content">
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
<div v-if="!!slots.actions" class="chad-card__actions">
|
||||
<slot name="actions" />
|
||||
</div>
|
||||
|
||||
<div v-if="!!slots.bottom" class="chad-card__bottom">
|
||||
<slot name="bottom" />
|
||||
</div>
|
||||
</Component>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: 'ChadCard',
|
||||
})
|
||||
|
||||
withDefaults(
|
||||
defineProps<Props>(),
|
||||
{
|
||||
as: 'div',
|
||||
},
|
||||
)
|
||||
|
||||
const slots = defineSlots<{
|
||||
default: []
|
||||
actions: []
|
||||
bottom: []
|
||||
}>()
|
||||
|
||||
interface Props {
|
||||
as?: string
|
||||
title?: string
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.chad-card {
|
||||
display: block;
|
||||
background-color: var(--paper);
|
||||
padding: var(--space-6);
|
||||
outline: var(--border-w) solid var(--ink);
|
||||
outline-offset: calc(var(--border-w) * -1);
|
||||
box-shadow: var(--shadow);
|
||||
|
||||
&__title {
|
||||
@include font-display-22;
|
||||
|
||||
margin-bottom: var(--space-6);
|
||||
}
|
||||
|
||||
&__actions {
|
||||
margin-top: var(--space-6);
|
||||
}
|
||||
|
||||
&__bottom {
|
||||
margin-top: var(--space-4);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,40 +1,47 @@
|
||||
<template>
|
||||
<FieldRoot class="chad-input" :invalid="!!error">
|
||||
<FieldLabel v-if="label" class="chad-input__label">
|
||||
<div
|
||||
class="chad-input"
|
||||
:class="{
|
||||
'is-invalid': !!error,
|
||||
}"
|
||||
>
|
||||
<label v-if="label" :for="inputId" class="chad-input__label">
|
||||
{{ label }}
|
||||
</FieldLabel>
|
||||
</label>
|
||||
|
||||
<div class="chad-input__control">
|
||||
<FieldInput v-model="modelValue" class="chad-input__input" :placeholder="placeholder" type="text" />
|
||||
</div>
|
||||
<input :id="inputId" v-model="modelValue" class="chad-input__input" :placeholder="placeholder" type="text">
|
||||
|
||||
<FieldHelperText v-if="helper" class="chad-input__helper">
|
||||
<p v-if="helper" class="chad-input__helper">
|
||||
{{ helper }}
|
||||
</FieldHelperText>
|
||||
<FieldErrorText v-if="error" class="chad-input__error">
|
||||
</p>
|
||||
<p v-if="error" class="chad-input__error">
|
||||
{{ error }}
|
||||
</FieldErrorText>
|
||||
</FieldRoot>
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { FieldInputProps, FieldRootProps } from '@ark-ui/vue/field'
|
||||
import { FieldErrorText, FieldHelperText, FieldInput, FieldLabel, FieldRoot } from '@ark-ui/vue/field'
|
||||
import { computed, useId } from 'vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'ChadInput',
|
||||
})
|
||||
|
||||
defineProps<Props>()
|
||||
|
||||
const modelValue = defineModel<FieldInputProps['modelValue']>('modelValue')
|
||||
|
||||
interface Props extends Omit<FieldRootProps, 'ids' | 'invalid'> {
|
||||
interface Props {
|
||||
id?: string
|
||||
label?: string
|
||||
placeholder?: string
|
||||
helper?: string
|
||||
error?: string
|
||||
}
|
||||
|
||||
defineOptions({
|
||||
name: 'ChadInput',
|
||||
})
|
||||
|
||||
const props = defineProps<Props>()
|
||||
|
||||
const modelValue = defineModel<string>('modelValue')
|
||||
|
||||
const inputId = computed(() => {
|
||||
return props.id ?? `input-${useId()}`
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@@ -42,47 +49,30 @@ interface Props extends Omit<FieldRootProps, 'ids' | 'invalid'> {
|
||||
$self: &;
|
||||
|
||||
&__label {
|
||||
@include font-label;
|
||||
|
||||
display: block;
|
||||
color: var(--text-muted);
|
||||
margin-bottom: 6px;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
&__control {
|
||||
border-radius: 12px;
|
||||
padding-inline: 12px;
|
||||
height: 44px;
|
||||
background-color: var(--bg-light);
|
||||
border: none;
|
||||
outline: 1px solid var(--border);
|
||||
outline-offset: -1px;
|
||||
font-size: 1rem;
|
||||
transition-property: background-color, outline-color;
|
||||
transition-duration: 150ms;
|
||||
transition-timing-function: ease-out;
|
||||
|
||||
&:hover,
|
||||
&:focus-within {
|
||||
outline-color: var(--primary);
|
||||
}
|
||||
|
||||
#{$self}[data-invalid] & {
|
||||
outline-color: var(--danger);
|
||||
}
|
||||
color: var(--grey-3);
|
||||
margin-bottom: var(--space-2);
|
||||
}
|
||||
|
||||
&__input {
|
||||
padding-inline: var(--space-3);
|
||||
height: 44px;
|
||||
background-color: var(--paper);
|
||||
outline: var(--border-w) solid var(--ink);
|
||||
outline-offset: calc(var(--border-w) * -1);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: none;
|
||||
border: none;
|
||||
outline: none;
|
||||
color: var(--text);
|
||||
caret-color: var(--secondary);
|
||||
color: var(--ink);
|
||||
caret-color: var(--yellow);
|
||||
caret-shape: block;
|
||||
|
||||
&::placeholder {
|
||||
color: var(--text-muted);
|
||||
font: inherit;
|
||||
color: var(--grey-3);
|
||||
opacity: 0.4;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
&:-webkit-autofill,
|
||||
@@ -94,21 +84,26 @@ interface Props extends Omit<FieldRootProps, 'ids' | 'invalid'> {
|
||||
box-shadow: 0 0 0px 1000px var(--bg) inset;
|
||||
background-color: var(--bg);
|
||||
}
|
||||
|
||||
#{$self}.is-invalid & {
|
||||
outline-color: var(--red);
|
||||
}
|
||||
}
|
||||
|
||||
&__helper,
|
||||
&__error {
|
||||
@include font-micro;
|
||||
|
||||
display: block;
|
||||
font-size: 0.75rem;
|
||||
margin-top: 6px;
|
||||
margin-top: var(--space-1);
|
||||
}
|
||||
|
||||
&__helper {
|
||||
color: var(--text-muted);
|
||||
color: var(--grey-3);
|
||||
}
|
||||
|
||||
&__error {
|
||||
color: var(--danger);
|
||||
color: var(--red);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,126 +1,131 @@
|
||||
<template>
|
||||
<FieldRoot class="chad-password-input" :invalid="!!error">
|
||||
<FieldLabel v-if="label" class="chad-password-input__label">
|
||||
<div class="chad-password-input" v-bind="api.getRootProps()">
|
||||
<label v-if="label" class="chad-password-input__label" v-bind="api.getLabelProps()">
|
||||
{{ label }}
|
||||
</FieldLabel>
|
||||
</label>
|
||||
|
||||
<PasswordInputRoot>
|
||||
<PasswordInputControl class="chad-password-input__control">
|
||||
<PasswordInputInput v-model="modelValue" class="chad-password-input__input" :placeholder="placeholder" />
|
||||
<PasswordInputVisibilityTrigger class="chad-password-input__visibility-trigger">
|
||||
<PasswordInputIndicator>
|
||||
Z
|
||||
<template #fallback>
|
||||
X
|
||||
</template>
|
||||
</PasswordInputIndicator>
|
||||
</PasswordInputVisibilityTrigger>
|
||||
</PasswordInputControl>
|
||||
</PasswordInputRoot>
|
||||
<div class="chad-password-input__control" v-bind="api.getControlProps()">
|
||||
<input v-bind="api.getInputProps()" v-model="modelValue" class="chad-password-input__input">
|
||||
|
||||
<FieldHelperText v-if="helper" class="chad-password-input__helper">
|
||||
{{ helper }}
|
||||
</FieldHelperText>
|
||||
<FieldErrorText v-if="error" class="chad-password-input__error">
|
||||
{{ error }}
|
||||
</FieldErrorText>
|
||||
</FieldRoot>
|
||||
<button class="chad-password-input__visibility-trigger" v-bind="api.getVisibilityTriggerProps()">
|
||||
<Component :is="api.visible ? EyeIcon : EyeOffIcon " v-bind="api.getIndicatorProps()" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { FieldInputProps, FieldRootProps } from '@ark-ui/vue/field'
|
||||
import { FieldErrorText, FieldHelperText, FieldLabel, FieldRoot } from '@ark-ui/vue/field'
|
||||
import { PasswordInputControl, PasswordInputIndicator, PasswordInputInput, PasswordInputRoot, PasswordInputVisibilityTrigger } from '@ark-ui/vue/password-input'
|
||||
import { EyeIcon, EyeOffIcon } from '@lucide/vue'
|
||||
import * as passwordInput from '@zag-js/password-input'
|
||||
import { normalizeProps, useMachine } from '@zag-js/vue'
|
||||
import { computed, useId } from 'vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'ChadPasswordInput',
|
||||
})
|
||||
|
||||
defineProps<Props>()
|
||||
|
||||
const modelValue = defineModel<FieldInputProps['modelValue']>('modelValue')
|
||||
|
||||
interface Props extends Omit<FieldRootProps, 'ids' | 'invalid'> {
|
||||
interface Props {
|
||||
id?: string
|
||||
label?: string
|
||||
placeholder?: string
|
||||
helper?: string
|
||||
error?: string
|
||||
}
|
||||
|
||||
defineOptions({
|
||||
name: 'ChadPasswordInput',
|
||||
})
|
||||
|
||||
const props = defineProps<Props>()
|
||||
|
||||
const modelValue = defineModel<string>('modelValue')
|
||||
|
||||
const inputId = computed(() => {
|
||||
return props.id ?? `input-${useId()}`
|
||||
})
|
||||
|
||||
const service = useMachine(passwordInput.machine, computed(() => {
|
||||
return {
|
||||
id: inputId.value,
|
||||
ignorePasswordManagers: true,
|
||||
autoComplete: undefined,
|
||||
}
|
||||
}))
|
||||
|
||||
const api = computed(() => passwordInput.connect(service, normalizeProps))
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.chad-password-input {
|
||||
$self: &;
|
||||
|
||||
&__label {
|
||||
@include font-label;
|
||||
|
||||
display: block;
|
||||
color: var(--text-muted);
|
||||
margin-bottom: 6px;
|
||||
font-size: 0.75rem;
|
||||
color: var(--grey-3);
|
||||
margin-bottom: var(--space-2);
|
||||
}
|
||||
|
||||
&__control {
|
||||
position: relative;
|
||||
border-radius: 12px;
|
||||
padding-inline: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 44px;
|
||||
width: 100%;
|
||||
background-color: var(--bg-light);
|
||||
border: none;
|
||||
outline: 1px solid var(--border);
|
||||
outline-offset: -1px;
|
||||
color: var(--text);
|
||||
caret-color: var(--secondary);
|
||||
font-size: 1rem;
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
outline-color: var(--primary);
|
||||
}
|
||||
|
||||
&::placeholder {
|
||||
color: var(--text-muted);
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
&[data-invalid] {
|
||||
outline-color: var(--danger);
|
||||
}
|
||||
|
||||
&:-webkit-autofill,
|
||||
&:-webkit-autofill:enabled,
|
||||
&:-webkit-autofill:hover,
|
||||
&:-webkit-autofill:focus {
|
||||
-webkit-text-fill-color: var(--text);
|
||||
-webkit-box-shadow: 0 0 0px 1000px var(--bg) inset;
|
||||
box-shadow: 0 0 0px 1000px var(--bg) inset;
|
||||
background-color: var(--bg);
|
||||
}
|
||||
}
|
||||
|
||||
&__input {
|
||||
flex: 1;
|
||||
padding-inline: var(--space-3);
|
||||
background-color: var(--paper);
|
||||
outline: var(--border-w) solid var(--ink);
|
||||
outline-offset: calc(var(--border-w) * -1);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: none;
|
||||
border: none;
|
||||
outline: none;
|
||||
color: var(--ink);
|
||||
caret-color: var(--yellow);
|
||||
caret-shape: block;
|
||||
|
||||
&::placeholder {
|
||||
font: inherit;
|
||||
color: var(--grey-3);
|
||||
opacity: 0.4;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
&[data-state='invalid'] {
|
||||
outline-color: var(--red);
|
||||
}
|
||||
}
|
||||
|
||||
&__visibility-trigger {
|
||||
position: absolute;
|
||||
flex-shrink: 0;
|
||||
background-color: var(--grey-1);
|
||||
border: var(--border-w) solid var(--ink);
|
||||
aspect-ratio: 1;
|
||||
border-left: 0;
|
||||
height: 100%;
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
background-color: var(--grey-2);
|
||||
}
|
||||
|
||||
&:active {
|
||||
background-color: var(--grey-3);
|
||||
}
|
||||
}
|
||||
|
||||
&__helper,
|
||||
&__error {
|
||||
@include font-micro;
|
||||
|
||||
display: block;
|
||||
font-size: 0.75rem;
|
||||
margin-top: 6px;
|
||||
margin-top: var(--space-1);
|
||||
}
|
||||
|
||||
&__helper {
|
||||
color: var(--text-muted);
|
||||
color: var(--grey-3);
|
||||
}
|
||||
|
||||
&__error {
|
||||
color: var(--danger);
|
||||
color: var(--red);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user