From 11012526427c9259c6d1f20cb3b837f5bbb761e6 Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Wed, 24 Jun 2020 11:51:53 +0200 Subject: [PATCH] renamed stores --- client/src/api/{index.js => todo.js} | 5 ++- client/src/components/Add.svelte | 2 +- client/src/components/Button.svelte | 4 ++- client/src/components/Field.svelte | 2 +- client/src/components/List.svelte | 2 +- client/src/components/Todo.svelte | 46 ++++++++++++++++++++-------- client/src/routes/_layout.svelte | 9 ++++-- client/src/routes/todo/[id].svelte | 10 +++++- client/src/stores.js | 6 ++++ 9 files changed, 62 insertions(+), 24 deletions(-) rename client/src/api/{index.js => todo.js} (88%) create mode 100644 client/src/stores.js diff --git a/client/src/api/index.js b/client/src/api/todo.js similarity index 88% rename from client/src/api/index.js rename to client/src/api/todo.js index 5338045..c38dcf1 100644 --- a/client/src/api/index.js +++ b/client/src/api/todo.js @@ -1,9 +1,8 @@ -import { writable } from 'svelte/store' import axios from 'axios' -axios.defaults.baseURL = '//localhost:8000' +import { todos } from '../stores' -export const todos = writable([]) +axios.defaults.baseURL = '//localhost:8000' export async function refresh() { const { data } = await axios({ diff --git a/client/src/components/Add.svelte b/client/src/components/Add.svelte index 2948d2e..d23eea0 100644 --- a/client/src/components/Add.svelte +++ b/client/src/components/Add.svelte @@ -2,7 +2,7 @@ import Button from './Button.svelte' import Field from './Field.svelte' - import { add } from '../api' + import { add } from '../api/todo.js' let title = '' diff --git a/client/src/components/Button.svelte b/client/src/components/Button.svelte index 978e915..a02c847 100644 --- a/client/src/components/Button.svelte +++ b/client/src/components/Button.svelte @@ -7,11 +7,13 @@ outline: none; border: none; color: hsl(0, 0%, 100%); - background-color: hsl(0, 0%, 0%); + background-color: var(--clr-accent); padding: 0.5em 1em; border-radius: 1em; font-size: inherit; cursor: pointer; + min-width: 5em; + text-align: center; } diff --git a/client/src/components/Field.svelte b/client/src/components/Field.svelte index acfb390..c5555cf 100644 --- a/client/src/components/Field.svelte +++ b/client/src/components/Field.svelte @@ -6,7 +6,7 @@ -
  • +
  • - -
  • diff --git a/client/src/routes/_layout.svelte b/client/src/routes/_layout.svelte index 7e16760..0c3f812 100644 --- a/client/src/routes/_layout.svelte +++ b/client/src/routes/_layout.svelte @@ -2,16 +2,19 @@ // import 'bootstrap/dist/css/bootstrap.min.css' import { onMount } from 'svelte' - import { refresh } from '../api' + import { refresh } from '../api/todo.js' onMount(() => { refresh() - console.log('mounted') })