From 9c71c3664fb8c61acc590e7f36dbe34100b0614a Mon Sep 17 00:00:00 2001 From: Bradley Shellnut Date: Sat, 1 Jul 2023 16:12:17 -0700 Subject: [PATCH] Alert on login failure and starting light/dark mode change. --- postcss.config.cjs | 9 ++- src/app.html | 46 ++++++++-------- src/lib/components/header/index.svelte | 9 ++- src/lib/components/ui/alert/Alert.svelte | 30 ++++++++++ .../ui/alert/AlertDescription.svelte | 10 ++++ src/lib/components/ui/alert/AlertTitle.svelte | 15 +++++ src/lib/components/ui/alert/index.ts | 3 + src/routes/auth/signin/+page.server.ts | 2 +- src/routes/auth/signin/+page.svelte | 55 +++++++++---------- src/routes/auth/signup/+page.svelte | 18 +++--- 10 files changed, 130 insertions(+), 67 deletions(-) create mode 100644 src/lib/components/ui/alert/Alert.svelte create mode 100644 src/lib/components/ui/alert/AlertDescription.svelte create mode 100644 src/lib/components/ui/alert/AlertTitle.svelte create mode 100644 src/lib/components/ui/alert/index.ts diff --git a/postcss.config.cjs b/postcss.config.cjs index 6bf2f0b..b1c1206 100644 --- a/postcss.config.cjs +++ b/postcss.config.cjs @@ -5,16 +5,19 @@ const atImport = require('postcss-import'); const config = { plugins: [ - tailwindcss(), atImport(), + // 'tailwindcss/nesting'(), + tailwindcss(), postcssPresetEnv({ stage: 2, features: { - 'nesting-rules': true, + 'nesting-rules': false, 'custom-media-queries': true, 'media-query-ranges': true } - }) + }), + + ] //Some plugins, like tailwindcss/nesting, need to run before Tailwind, tailwindcss(), //But others, like autoprefixer, need to run after, autoprefixer] }; diff --git a/src/app.html b/src/app.html index 7c1336b..819e097 100644 --- a/src/app.html +++ b/src/app.html @@ -6,34 +6,34 @@ %sveltekit.head% diff --git a/src/lib/components/header/index.svelte b/src/lib/components/header/index.svelte index b45e950..fba1156 100644 --- a/src/lib/components/header/index.svelte +++ b/src/lib/components/header/index.svelte @@ -1,5 +1,7 @@ + +
+ +
diff --git a/src/lib/components/ui/alert/AlertDescription.svelte b/src/lib/components/ui/alert/AlertDescription.svelte new file mode 100644 index 0000000..32b04d8 --- /dev/null +++ b/src/lib/components/ui/alert/AlertDescription.svelte @@ -0,0 +1,10 @@ + + +
+ +
diff --git a/src/lib/components/ui/alert/AlertTitle.svelte b/src/lib/components/ui/alert/AlertTitle.svelte new file mode 100644 index 0000000..3a40aaf --- /dev/null +++ b/src/lib/components/ui/alert/AlertTitle.svelte @@ -0,0 +1,15 @@ + + + + + diff --git a/src/lib/components/ui/alert/index.ts b/src/lib/components/ui/alert/index.ts new file mode 100644 index 0000000..94f305b --- /dev/null +++ b/src/lib/components/ui/alert/index.ts @@ -0,0 +1,3 @@ +export { default as Alert } from "./Alert.svelte"; +export { default as AlertDescription } from "./AlertDescription.svelte"; +export { default as AlertTitle } from "./AlertTitle.svelte"; diff --git a/src/routes/auth/signin/+page.server.ts b/src/routes/auth/signin/+page.server.ts index d4c0d10..b90d764 100644 --- a/src/routes/auth/signin/+page.server.ts +++ b/src/routes/auth/signin/+page.server.ts @@ -52,7 +52,7 @@ export const actions = { // TODO: need to return error message to the client console.error(e); form.data.password = ''; - return setError(form, '', 'The username or password is incorrect.'); + return setError(form, '', 'Your username or password is incorrect.'); } form.data.username = ''; form.data.password = ''; diff --git a/src/routes/auth/signin/+page.svelte b/src/routes/auth/signin/+page.svelte index 8c58491..1978259 100644 --- a/src/routes/auth/signin/+page.svelte +++ b/src/routes/auth/signin/+page.svelte @@ -1,46 +1,43 @@ -
+
{#if $errors._errors} - + + + Error + + {$errors._errors} + + {/if} -
-

- Sign into your account -

- - - {#if $errors.username} -

{$errors.username}

- {/if} - - - {#if $errors.password} -

{$errors.password}

- {/if} - -
- \ No newline at end of file +
+
+

+ Sign into your account +

+ + + + + +
+
+
\ No newline at end of file diff --git a/src/routes/auth/signup/+page.svelte b/src/routes/auth/signup/+page.svelte index 49b947e..7b1f06f 100644 --- a/src/routes/auth/signup/+page.svelte +++ b/src/routes/auth/signup/+page.svelte @@ -25,43 +25,45 @@ import { userSchema } from '$lib/config/zod-schemas.js';
-
+

Signup for an account

- + {#if $errors.firstName}

{$errors.firstName}

{/if} - + {#if $errors.lastName}

{$errors.lastName}

{/if} - + {#if $errors.email}

{$errors.email}

{/if} - + {#if $errors.username}

{$errors.username}

{/if} - + {#if $errors.password}

{$errors.password}

{/if} - + {#if $errors.confirm_password}

{$errors.confirm_password}

{/if} -
+