1
0
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:
2022-11-09 20:02:28 +07:00
parent 10498fe8b3
commit f8a03bf7f7
20 changed files with 1358 additions and 783 deletions

9
.gitignore vendored
View File

@@ -10,10 +10,11 @@ tmp
# Build # Build
src/.nuxt src/.nuxt
src/.nitro .nuxt
src/.cache .nitro
src/.output .cache
src/dist .output
dist
# Environment # Environment
.env .env

View File

@@ -1,12 +1,14 @@
// https://v3.nuxtjs.org/api/configuration/nuxt.config // https://v3.nuxtjs.org/api/configuration/nuxt.config
import {defineNuxtConfig} from 'nuxt/config';
import {resolve} from 'path'; import {resolve} from 'path';
const SRC = resolve(__dirname, 'src'); const SRC = resolve(__dirname, 'src');
export default defineNuxtConfig({ export default defineNuxtConfig({
rootDir: SRC, srcDir: SRC,
app: { app: {
head: { head: {
title: 'Canvas 3D',
link: [{rel: 'icon', href: '/favicon.svg'}], link: [{rel: 'icon', href: '/favicon.svg'}],
}, },
}, },

1881
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -3,6 +3,9 @@
"scripts": { "scripts": {
"build": "nuxt build", "build": "nuxt build",
"dev": "nuxt dev", "dev": "nuxt dev",
"typecheck": "nuxt typecheck",
"info": "nuxt info",
"analyze": "nuxt analyze",
"generate": "nuxt generate", "generate": "nuxt generate",
"preview": "nuxt preview", "preview": "nuxt preview",
"postinstall": "nuxt prepare" "postinstall": "nuxt prepare"

View File

@@ -1,3 +1,5 @@
<template> <template>
<NuxtLayout>
<NuxtPage /> <NuxtPage />
</NuxtLayout>
</template> </template>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View 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);
}

View File

@@ -39,3 +39,13 @@ $fonts: (
); );
@include MakeFont('Formular', $fonts, '@/assets/fonts/formular'); @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;
}

View File

@@ -1,3 +1,8 @@
body { * {
margin: 0; margin: 0;
padding: 0;
border: 0;
outline: none;
background: none;
box-sizing: border-box;
} }

View 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;
}

View File

@@ -1,4 +1,10 @@
:root { :root {
--background-color-primary: #f3f3f3; --background-color-primary: #f3f3f3;
--font-color-primary: #3d3d3d; --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);
} }

View File

@@ -1,6 +1,8 @@
@import 'reset'; @import 'reset';
@import 'variables'; @import 'variables';
@import 'fonts'; @import 'fonts';
@import 'scroll';
@import 'animations';
html, body, #__nuxt { html, body, #__nuxt {
width: 100%; width: 100%;
@@ -12,3 +14,9 @@ body {
color: var(--font-color-primary); color: var(--font-color-primary);
font-family: Formular, Helvetica, Arial, sans-serif; font-family: Formular, Helvetica, Arial, sans-serif;
} }
button {
width: 20px;
height: 20px;
cursor: pointer;
}

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>