-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add types * fix captcha * buncha type fixes * agency partner types * add to prerender routes * directory page block * form components * new pages * helpers * update deps * fix filter causing build to fail * fix card * fix main content bottom border * mobile filters * Fix OG Images * fix placement of clear filter button on desktop * add directus-format-title package * fix lint issues
- Loading branch information
1 parent
5984343
commit f88d2c4
Showing
48 changed files
with
8,826 additions
and
5,477 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
<script setup lang="ts"> | ||
interface Option { | ||
label: string; | ||
value: string; | ||
} | ||
interface Props { | ||
modelValue: string[] | undefined; | ||
options: Option[]; | ||
name?: string; | ||
} | ||
const props = withDefaults(defineProps<Props>(), { | ||
name: 'checkbox-group', | ||
modelValue: () => [], | ||
}); | ||
const emit = defineEmits(['update:modelValue']); | ||
const updateValue = (value: string) => { | ||
const currentValue = props.modelValue || []; | ||
const index = currentValue.indexOf(value); | ||
let newValue; | ||
if (index === -1) { | ||
newValue = [...currentValue, value]; | ||
} else { | ||
newValue = currentValue.filter((v) => v !== value); | ||
} | ||
emit('update:modelValue', newValue); | ||
}; | ||
const isChecked = (value: string) => (props.modelValue || []).includes(value); | ||
const { theme } = useTheme(); | ||
</script> | ||
|
||
<template> | ||
<div class="checkbox-group" :class="`theme-${theme}`"> | ||
<div v-for="option in options" :key="option.value" class="checkbox-wrapper"> | ||
<input | ||
:id="`${name}-${option.value}`" | ||
type="checkbox" | ||
:name="name" | ||
:value="option.value" | ||
:checked="isChecked(option.value)" | ||
@change="updateValue(option.value)" | ||
/> | ||
<label :for="`${name}-${option.value}`">{{ option.label }}</label> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
.checkbox-group { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--space-2); | ||
.checkbox-wrapper { | ||
display: flex; | ||
align-items: center; | ||
font-size: var(--font-size-sm); | ||
line-height: var(--line-height-sm); | ||
input[type='checkbox'] { | ||
appearance: none; | ||
-webkit-appearance: none; | ||
-moz-appearance: none; | ||
width: var(--space-6); | ||
height: var(--space-6); | ||
border: 2px solid var(--gray-300); | ||
border-radius: var(--rounded-sm); | ||
margin-right: var(--space-3); | ||
cursor: pointer; | ||
position: relative; | ||
transition: var(--duration-150) var(--ease-out); | ||
&:hover { | ||
border-color: var(--gray-400); | ||
} | ||
&:checked { | ||
background-color: var(--primary); | ||
border-color: var(--primary); | ||
&::after { | ||
content: ''; | ||
position: absolute; | ||
left: 6px; | ||
top: 2px; | ||
width: 6px; | ||
height: 12px; | ||
border: solid white; | ||
border-width: 0 2px 2px 0; | ||
transform: rotate(45deg); | ||
} | ||
} | ||
&:focus { | ||
outline: none; | ||
box-shadow: 0 0 0 3px var(--primary-100); | ||
} | ||
} | ||
label { | ||
cursor: pointer; | ||
user-select: none; | ||
padding-top: 2px; | ||
text-transform: capitalize; | ||
} | ||
} | ||
} | ||
.theme-dark { | ||
.checkbox-wrapper { | ||
input[type='checkbox'] { | ||
border-color: var(--gray-600); | ||
background-color: var(--gray-700); | ||
&:hover { | ||
border-color: var(--gray-500); | ||
} | ||
&:checked { | ||
background-color: var(--primary); | ||
border-color: var(--primary); | ||
} | ||
&:focus { | ||
box-shadow: 0 0 0 3px var(--primary-800); | ||
} | ||
} | ||
label { | ||
color: var(--gray-200); | ||
} | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<script setup lang="ts"> | ||
interface Props { | ||
label?: string; | ||
required?: boolean; | ||
error?: string; | ||
hideLabel?: boolean; | ||
} | ||
const props = withDefaults(defineProps<Props>(), { | ||
required: false, | ||
hideLabel: false, | ||
}); | ||
const { theme } = useTheme(); | ||
</script> | ||
|
||
<template> | ||
<div class="form-group" :class="`theme-${theme}`"> | ||
<label v-if="label && !hideLabel" :for="label"> | ||
{{ label }} | ||
<span v-if="required" class="required">*</span> | ||
</label> | ||
<slot></slot> | ||
<ul v-if="error" class="error-messages"> | ||
<li> | ||
<label>{{ error }}</label> | ||
</li> | ||
</ul> | ||
</div> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
.form-group { | ||
font-size: var(--font-size-sm); | ||
line-height: var(--line-height-sm); | ||
label { | ||
font-weight: 600; | ||
display: block; | ||
margin-bottom: var(--space-2); | ||
text-transform: capitalize; | ||
} | ||
.required { | ||
color: var(--primary); | ||
} | ||
.error-messages { | ||
margin: 0; | ||
padding: 0; | ||
list-style: none; | ||
color: var(--danger); | ||
font-style: italic; | ||
margin-block-start: var(--space-1); | ||
li label { | ||
font-weight: 500; | ||
font-size: var(--font-size-xs); | ||
line-height: var(--line-height-xs); | ||
} | ||
} | ||
} | ||
.theme-dark { | ||
.error-messages { | ||
color: var(--danger); | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.