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:
@@ -1,3 +1,5 @@
|
||||
<template>
|
||||
<NuxtPage/>
|
||||
<NuxtLayout>
|
||||
<NuxtPage />
|
||||
</NuxtLayout>
|
||||
</template>
|
||||
|
||||
BIN
src/assets/fonts/computer-modern/cmunrm.eot
Normal file
BIN
src/assets/fonts/computer-modern/cmunrm.eot
Normal file
Binary file not shown.
BIN
src/assets/fonts/computer-modern/cmunrm.ttf
Normal file
BIN
src/assets/fonts/computer-modern/cmunrm.ttf
Normal file
Binary file not shown.
BIN
src/assets/fonts/computer-modern/cmunrm.woff
Normal file
BIN
src/assets/fonts/computer-modern/cmunrm.woff
Normal file
Binary file not shown.
12
src/assets/styles/_animations.scss
Normal file
12
src/assets/styles/_animations.scss
Normal file
@@ -0,0 +1,12 @@
|
||||
.slide-leave-active,
|
||||
.slide-enter-active {
|
||||
transition: 1s;
|
||||
}
|
||||
|
||||
.slide-enter {
|
||||
transform: translate(100%, 0);
|
||||
}
|
||||
|
||||
.slide-leave-to {
|
||||
transform: translate(-100%, 0);
|
||||
}
|
||||
@@ -39,3 +39,13 @@ $fonts: (
|
||||
);
|
||||
|
||||
@include MakeFont('Formular', $fonts, '@/assets/fonts/formular');
|
||||
|
||||
@font-face {
|
||||
font-family: 'Computer Modern Serif';
|
||||
src: url('@/assets/fonts/computer-modern/cmunrm.eot');
|
||||
src: url('@/assets/fonts/computer-modern/cmunrm.eot?#iefix') format('embedded-opentype'),
|
||||
url('@/assets/fonts/computer-modern/cmunrm.woff') format('woff'),
|
||||
url('@/assets/fonts/computer-modern/cmunrm.ttf') format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
body {
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
outline: none;
|
||||
background: none;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
12
src/assets/styles/_scroll.scss
Normal file
12
src/assets/styles/_scroll.scss
Normal file
@@ -0,0 +1,12 @@
|
||||
::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background-color: var(--scroll-color);
|
||||
transition: background-color 0.1s;
|
||||
}
|
||||
@@ -1,4 +1,10 @@
|
||||
:root {
|
||||
--background-color-primary: #f3f3f3;
|
||||
--font-color-primary: #3d3d3d;
|
||||
--border-color: #e4e1e1;
|
||||
--icon-color: #5e5f60;
|
||||
--seconary-color: #8d8d8d;
|
||||
--shadow-color: rgba(163, 167, 174, 0.2);
|
||||
--border: 1px solid var(--border-color);
|
||||
--shadow: 0 0 9px 0 var(--shadow-color);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
@import 'reset';
|
||||
@import 'variables';
|
||||
@import 'fonts';
|
||||
@import 'scroll';
|
||||
@import 'animations';
|
||||
|
||||
html, body, #__nuxt {
|
||||
width: 100%;
|
||||
@@ -12,3 +14,9 @@ body {
|
||||
color: var(--font-color-primary);
|
||||
font-family: Formular, Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
button {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
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