Code cleanup, move docs data to json, update docs structure

This commit is contained in:
Vadim
2021-01-27 20:17:28 +03:00
parent 7c9b2e77be
commit cb7071bf04
13 changed files with 136 additions and 124 deletions

View File

@@ -33,6 +33,7 @@
"devDependencies": { "devDependencies": {
"@babel/core": "^7.12.10", "@babel/core": "^7.12.10",
"@rollup/plugin-commonjs": "^17.0.0", "@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^11.0.0", "@rollup/plugin-node-resolve": "^11.0.0",
"@storybook/addon-actions": "^6.1.14", "@storybook/addon-actions": "^6.1.14",
"@storybook/addon-essentials": "^6.1.14", "@storybook/addon-essentials": "^6.1.14",

View File

@@ -2,6 +2,7 @@ import { join } from 'path';
import svelte from 'rollup-plugin-svelte'; import svelte from 'rollup-plugin-svelte';
import commonjs from '@rollup/plugin-commonjs'; import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve'; import resolve from '@rollup/plugin-node-resolve';
import json from '@rollup/plugin-json';
import livereload from 'rollup-plugin-livereload'; import livereload from 'rollup-plugin-livereload';
import { terser } from 'rollup-plugin-terser'; import { terser } from 'rollup-plugin-terser';
import css from 'rollup-plugin-css-only'; import css from 'rollup-plugin-css-only';
@@ -93,7 +94,9 @@ export default {
// If we're building for production (npm run build // If we're building for production (npm run build
// instead of npm run dev), minify // instead of npm run dev), minify
production && terser() production && terser(),
json(),
], ],
watch: { watch: {
clearScreen: false clearScreen: false

View File

@@ -1,29 +1,11 @@
<script> <script>
import _ from 'lodash' import _ from 'lodash'
import Carousel from '../components/Carousel/Carousel.svelte' import Carousel from '../components/Carousel/Carousel.svelte'
import Color from './Color.svelte' import Color from './components/Color.svelte'
import AlbumsPreview from './AlbumsPreview/AlbumsPreview.svelte' import AlbumsPreview from './components/AlbumsPreview/AlbumsPreview.svelte'
import Divider from './Divider.svelte' import Divider from './components/Divider.svelte'
import images from './data/images.json'
const colors = [ import colors from './data/colors.json'
{ color: '#85d78b', text: '#85d78b' },
{ color: '#71d077', text: '#71d077' },
{ color: '#5dca64', text: '#5dca64' },
{ color: '#49c351', text: '#49c351' },
{ color: '#35bd3e', text: '#35bd3e' },
{ color: '#2faa37', text: '#2faa37' },
{ color: '#2a9731', text: '#2a9731' },
{ color: '#25842b', text: '#25842b' },
{ color: '#1f7125', text: '#1f7125' },
]
const images = [
'https://cdn.pixabay.com/photo/2017/03/13/10/25/hummingbird-2139278_1280.jpg',
'https://cdn.pixabay.com/photo/2016/03/27/19/49/nature-1283976_1280.jpg',
'https://cdn.pixabay.com/photo/2018/07/09/18/17/apple-3526737_1280.jpg',
'https://cdn.pixabay.com/photo/2016/08/30/16/05/leaf-1631181_1280.jpg',
'https://cdn.pixabay.com/photo/2019/11/13/11/01/meadow-4623279_1280.jpg'
]
</script> </script>
# Features # Features

View File

@@ -1,11 +0,0 @@
<div class="divider">
</div>
<style>
.divider {
margin-top: 30px;
margin-bottom: 30px;
height: 1px;
}
</style>

View File

@@ -1,47 +1,8 @@
<script> <script>
import Carousel from '../../components/Carousel/Carousel.svelte' import Carousel from '../../../components/Carousel/Carousel.svelte'
import Image from './Image.svelte' import Image from './Image.svelte'
import albums from '../../data/albums.json'
const albums = {
forest: {
title: 'Forest',
tags: ['forest', 'trees'],
images: [
'https://cdn.pixabay.com/photo/2017/04/09/09/56/avenue-2215317_1280.jpg',
'https://cdn.pixabay.com/photo/2017/11/12/13/37/forest-2942477_1280.jpg',
'https://cdn.pixabay.com/photo/2016/08/11/23/55/trees-1587301_1280.jpg',
'https://cdn.pixabay.com/photo/2016/08/16/19/09/forest-1598756_1280.jpg',
'https://cdn.pixabay.com/photo/2016/11/29/07/12/forest-1868028_1280.jpg',
'https://cdn.pixabay.com/photo/2015/03/26/09/45/woods-690257_1280.jpg'
]
},
birds: {
title: 'Birds',
tags: ['birds', 'owl', 'parrot'],
images: [
'https://cdn.pixabay.com/photo/2016/11/18/12/14/owl-1834152_1280.jpg',
'https://cdn.pixabay.com/photo/2016/05/26/04/19/macaw-1416388_1280.jpg'
]
},
flowers: {
title: 'Flowers',
tags: ['flowers', 'blossom', 'beauty'],
images: [
'https://cdn.pixabay.com/photo/2018/09/06/23/37/hydrangea-3659614_1280.jpg',
'https://cdn.pixabay.com/photo/2016/04/12/18/19/carnation-1325012_1280.jpg',
'https://cdn.pixabay.com/photo/2017/06/06/19/18/rose-2378156_1280.jpg'
]
},
coffee: {
title: 'Coffee',
tags: ['coffee', 'cup'],
images: [
'https://cdn.pixabay.com/photo/2017/05/12/08/29/coffee-2306471_1280.jpg',
'https://cdn.pixabay.com/photo/2016/03/30/21/59/coffee-beans-1291656_1280.jpg',
'https://cdn.pixabay.com/photo/2018/01/31/09/57/coffee-3120750_1280.jpg',
]
}
}
function imagesLength(length) { function imagesLength(length) {
return `${length} image${length > 1 ? 's' : ''}` return `${length} image${length > 1 ? 's' : ''}`
} }

View File

@@ -0,0 +1,11 @@
<div class="divider">
</div>
<style>
.divider {
margin-top: 30px;
margin-bottom: 30px;
height: 1px;
}
</style>

40
src/docs/data/albums.json Normal file
View File

@@ -0,0 +1,40 @@
{
"forest": {
"title": "Forest",
"tags": ["forest", "trees"],
"images": [
"https://cdn.pixabay.com/photo/2017/04/09/09/56/avenue-2215317_1280.jpg",
"https://cdn.pixabay.com/photo/2017/11/12/13/37/forest-2942477_1280.jpg",
"https://cdn.pixabay.com/photo/2016/08/11/23/55/trees-1587301_1280.jpg",
"https://cdn.pixabay.com/photo/2016/08/16/19/09/forest-1598756_1280.jpg",
"https://cdn.pixabay.com/photo/2016/11/29/07/12/forest-1868028_1280.jpg",
"https://cdn.pixabay.com/photo/2015/03/26/09/45/woods-690257_1280.jpg"
]
},
"birds": {
"title": "Birds",
"tags": ["birds", "owl", "parrot"],
"images": [
"https://cdn.pixabay.com/photo/2016/11/18/12/14/owl-1834152_1280.jpg",
"https://cdn.pixabay.com/photo/2016/05/26/04/19/macaw-1416388_1280.jpg"
]
},
"flowers": {
"title": "Flowers",
"tags": ["flowers", "blossom", "beauty"],
"images": [
"https://cdn.pixabay.com/photo/2018/09/06/23/37/hydrangea-3659614_1280.jpg",
"https://cdn.pixabay.com/photo/2016/04/12/18/19/carnation-1325012_1280.jpg",
"https://cdn.pixabay.com/photo/2017/06/06/19/18/rose-2378156_1280.jpg"
]
},
"coffee": {
"title": "Coffee",
"tags": ["coffee", "cup"],
"images": [
"https://cdn.pixabay.com/photo/2017/05/12/08/29/coffee-2306471_1280.jpg",
"https://cdn.pixabay.com/photo/2016/03/30/21/59/coffee-beans-1291656_1280.jpg",
"https://cdn.pixabay.com/photo/2018/01/31/09/57/coffee-3120750_1280.jpg"
]
}
}

11
src/docs/data/colors.json Normal file
View File

@@ -0,0 +1,11 @@
[
{ "color": "#85d78b", "text": "#85d78b" },
{ "color": "#71d077", "text": "#71d077" },
{ "color": "#5dca64", "text": "#5dca64" },
{ "color": "#49c351", "text": "#49c351" },
{ "color": "#35bd3e", "text": "#35bd3e" },
{ "color": "#2faa37", "text": "#2faa37" },
{ "color": "#2a9731", "text": "#2a9731" },
{ "color": "#25842b", "text": "#25842b" },
{ "color": "#1f7125", "text": "#1f7125" }
]

View File

@@ -0,0 +1,7 @@
[
"https://cdn.pixabay.com/photo/2017/03/13/10/25/hummingbird-2139278_1280.jpg",
"https://cdn.pixabay.com/photo/2016/03/27/19/49/nature-1283976_1280.jpg",
"https://cdn.pixabay.com/photo/2018/07/09/18/17/apple-3526737_1280.jpg",
"https://cdn.pixabay.com/photo/2016/08/30/16/05/leaf-1631181_1280.jpg",
"https://cdn.pixabay.com/photo/2019/11/13/11/01/meadow-4623279_1280.jpg"
]

View File

@@ -1227,6 +1227,13 @@
magic-string "^0.25.7" magic-string "^0.25.7"
resolve "^1.17.0" resolve "^1.17.0"
"@rollup/plugin-json@^4.1.0":
version "4.1.0"
resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-4.1.0.tgz#54e09867ae6963c593844d8bd7a9c718294496f3"
integrity sha512-yfLbTdNS6amI/2OpmbiBoW12vngr5NW2jCJVZSBEz+H5KfUJZ2M7sDjk0U6GOOdCWFVScShte29o9NezJ53TPw==
dependencies:
"@rollup/pluginutils" "^3.0.8"
"@rollup/plugin-node-resolve@^11.0.0": "@rollup/plugin-node-resolve@^11.0.0":
version "11.1.0" version "11.1.0"
resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-11.1.0.tgz#fa0f888297b3aebcd6534e8aba4e6fe01997649a" resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-11.1.0.tgz#fa0f888297b3aebcd6534e8aba4e6fe01997649a"
@@ -1247,7 +1254,7 @@
estree-walker "^2.0.1" estree-walker "^2.0.1"
picomatch "^2.2.2" picomatch "^2.2.2"
"@rollup/pluginutils@^3.1.0": "@rollup/pluginutils@^3.0.8", "@rollup/pluginutils@^3.1.0":
version "3.1.0" version "3.1.0"
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b" resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b"
integrity sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg== integrity sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==