mirror of
https://github.com/robonen/canvas-3d.git
synced 2026-03-20 02:44:40 +00:00
feat(components): index page components
This commit is contained in:
53
src/components/accordion.vue
Normal file
53
src/components/accordion.vue
Normal file
@@ -0,0 +1,53 @@
|
||||
<script setup lang="ts">
|
||||
const {title} = defineProps<{ title: string }>();
|
||||
const showForm = ref<boolean>(false);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="block">
|
||||
<div class="header" @click="showForm = !showForm">
|
||||
<h2 class="title">{{ title }}</h2>
|
||||
<button class="button">
|
||||
<IconClose v-if="showForm"/>
|
||||
<IconOpen v-else/>
|
||||
</button>
|
||||
</div>
|
||||
<div class="content" v-if="showForm">
|
||||
<slot/>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.block {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
row-gap: 12px;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
column-gap: 12px;
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
padding: 8px 0;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 1.04rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.button {
|
||||
color: var(--icon-color);
|
||||
}
|
||||
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
row-gap: 16px;
|
||||
padding: 0 4px;
|
||||
}
|
||||
</style>
|
||||
105
src/components/form/range.vue
Normal file
105
src/components/form/range.vue
Normal file
@@ -0,0 +1,105 @@
|
||||
<script setup lang="ts">
|
||||
const {
|
||||
label,
|
||||
min,
|
||||
max,
|
||||
defaultValue,
|
||||
step = 0.1
|
||||
} = defineProps<{ label: string, min: number, max: number, defaultValue: number, step?: number }>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(event: 'change', value: number): void
|
||||
}>();
|
||||
|
||||
const value = ref<number>(defaultValue);
|
||||
|
||||
const onChange = (event: Event) => {
|
||||
value.value = (event.target as HTMLInputElement).valueAsNumber;
|
||||
emit('change', value.value);
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="block">
|
||||
<label class="label">
|
||||
{{ label }}
|
||||
<input :max="max" :min="min" :value="value" class="input" type="number" @input="onChange"/>
|
||||
</label>
|
||||
<div class="range">
|
||||
<div class="range__border">{{ min }}</div>
|
||||
<input :max="max" :min="min" :step="step" :value="value" class="range__input" type="range" @input="onChange"
|
||||
@dblclick="value = defaultValue"/>
|
||||
<div class="range__border">{{ max }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.block {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
column-gap: 12px;
|
||||
}
|
||||
|
||||
.label {
|
||||
display: flex;
|
||||
column-gap: 4px;
|
||||
font-size: 18px;
|
||||
font-family: 'Computer Modern Serif', serif;
|
||||
}
|
||||
|
||||
.input {
|
||||
flex: 1;
|
||||
font-family: 'Computer Modern Serif', serif;
|
||||
font-size: inherit;
|
||||
|
||||
&::-webkit-outer-spin-button,
|
||||
&::-webkit-inner-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
&[type=number] {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
}
|
||||
|
||||
.range {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
column-gap: 14px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.range__border {
|
||||
font-size: 12px;
|
||||
color: var(--seconary-color);
|
||||
}
|
||||
|
||||
.range__input {
|
||||
-webkit-appearance: none;
|
||||
flex: 1;
|
||||
height: 6px;
|
||||
border-radius: 4px;
|
||||
margin: 10px 0;
|
||||
background: #e2e4e6;
|
||||
transition: opacity .2s;
|
||||
|
||||
&:hover, &:focus {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
&::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border-radius: 50%;
|
||||
background-color: #ff5c8e;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
6
src/components/icon/close.vue
Normal file
6
src/components/icon/close.vue
Normal file
@@ -0,0 +1,6 @@
|
||||
<template>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
|
||||
class="w-6 h-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M4.5 15.75l7.5-7.5 7.5 7.5"/>
|
||||
</svg>
|
||||
</template>
|
||||
6
src/components/icon/hide.vue
Normal file
6
src/components/icon/hide.vue
Normal file
@@ -0,0 +1,6 @@
|
||||
<template>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
|
||||
class="w-6 h-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M18.75 19.5l-7.5-7.5 7.5-7.5m-6 15L5.25 12l7.5-7.5"/>
|
||||
</svg>
|
||||
</template>
|
||||
7
src/components/icon/menu.vue
Normal file
7
src/components/icon/menu.vue
Normal file
@@ -0,0 +1,7 @@
|
||||
<template>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
|
||||
class="w-6 h-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"/>
|
||||
</svg>
|
||||
</template>
|
||||
|
||||
6
src/components/icon/open.vue
Normal file
6
src/components/icon/open.vue
Normal file
@@ -0,0 +1,6 @@
|
||||
<template>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
|
||||
class="w-6 h-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5"/>
|
||||
</svg>
|
||||
</template>
|
||||
Reference in New Issue
Block a user