Skip to content

Commit

Permalink
Fix: Design & Misc (#68)
Browse files Browse the repository at this point in the history
Co-authored-by: Antoine Lethimonnier <[email protected]>
  • Loading branch information
MinixBF and WarningImHack3r authored Aug 11, 2023
1 parent 07dc675 commit 5b5446f
Show file tree
Hide file tree
Showing 13 changed files with 118 additions and 36 deletions.
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"css.customData": [".vscode/tailwind.json"],
"tailwindCSS.classAttributes": [
"class",
"enter",
"enterFrom",
"enterTo",
"leave",
"leaveFrom",
"leaveTo"
]
}
55 changes: 55 additions & 0 deletions .vscode/tailwind.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"version": 1.1,
"atDirectives": [
{
"name": "@tailwind",
"description": "Use the `@tailwind` directive to insert Tailwind's `base`, `components`, `utilities` and `screens` styles into your CSS.",
"references": [
{
"name": "Tailwind Documentation",
"url": "https://tailwindcss.com/docs/functions-and-directives#tailwind"
}
]
},
{
"name": "@apply",
"description": "Use the `@apply` directive to inline any existing utility classes into your own custom CSS. This is useful when you find a common utility pattern in your HTML that you’d like to extract to a new component.",
"references": [
{
"name": "Tailwind Documentation",
"url": "https://tailwindcss.com/docs/functions-and-directives#apply"
}
]
},
{
"name": "@responsive",
"description": "You can generate responsive variants of your own classes by wrapping their definitions in the `@responsive` directive:\n```css\n@responsive {\n .alert {\n background-color: #E53E3E;\n }\n}\n```\n",
"references": [
{
"name": "Tailwind Documentation",
"url": "https://tailwindcss.com/docs/functions-and-directives#responsive"
}
]
},
{
"name": "@screen",
"description": "The `@screen` directive allows you to create media queries that reference your breakpoints by **name** instead of duplicating their values in your own CSS:\n```css\n@screen sm {\n /* ... */\n}\n```\n…gets transformed into this:\n```css\n@media (min-width: 640px) {\n /* ... */\n}\n```\n",
"references": [
{
"name": "Tailwind Documentation",
"url": "https://tailwindcss.com/docs/functions-and-directives#screen"
}
]
},
{
"name": "@variants",
"description": "Generate `hover`, `focus`, `active` and other **variants** of your own utilities by wrapping their definitions in the `@variants` directive:\n```css\n@variants hover, focus {\n .btn-brand {\n background-color: #3182CE;\n }\n}\n```\n",
"references": [
{
"name": "Tailwind Documentation",
"url": "https://tailwindcss.com/docs/functions-and-directives#variants"
}
]
}
]
}
15 changes: 15 additions & 0 deletions src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,18 @@
@import "./chillax.css";
@import "tailwindcss/components";
@import "tailwindcss/utilities";

@layer base {
::selection {
@apply bg-dominant/75 text-primary;
}

body {
@apply bg-primary text-primary;
}

:root {
/* To color scrollbars, form controls and other system colors */
color-scheme: dark;
}
}
1 change: 1 addition & 0 deletions src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.svg" />
<meta name="viewport" content="width=device-width" />
<meta name="color-scheme" content="dark" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
Expand Down
4 changes: 3 additions & 1 deletion src/lib/elements/Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
*/
export let type: "primary" | "secondary" | "minimal" = "primary";
const dispatch = createEventDispatcher();
const dispatch = createEventDispatcher<{
click: null;
}>();
</script>

{#if type === "primary"}
Expand Down
5 changes: 4 additions & 1 deletion src/lib/elements/RadioButtonsGroup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
*/
export let description: string;
const dispatch = createEventDispatcher();
const dispatch = createEventDispatcher<{
change: { index: number };
hover: { index: number };
}>();
</script>

<div
Expand Down
5 changes: 4 additions & 1 deletion src/lib/shells/MagneticElement.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
// Constants
const elementId = `svelte-magnetic-element-${useId()}`;
const dispatch = createEventDispatcher();
const dispatch = createEventDispatcher<{
in_zone: { element: HTMLElement };
out_zone: { element: HTMLElement };
}>();
// Configuration
/**
Expand Down
4 changes: 2 additions & 2 deletions src/lib/shells/SlideOver.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
<div class="absolute inset-0 overflow-hidden">
<div class="pointer-events-none fixed inset-y-0 right-0 flex max-w-full sm:pl-10">
<TransitionChild
enter="transform transition ease-in-out duration-500 sm:duration-700"
enter="ease-in-out duration-500 sm:duration-700"
enterFrom="translate-x-full"
enterTo="translate-x-0"
leave="transform transition ease-in-out duration-500 sm:duration-700"
leave="ease-in-out duration-500 sm:duration-700"
leaveFrom="translate-x-0"
leaveTo="translate-x-full"
>
Expand Down
4 changes: 4 additions & 0 deletions src/locales/en/errors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"error": "Error",
"go-home": "Go back to a safe place"
}
4 changes: 4 additions & 0 deletions src/locales/fr/errors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"error": "Erreur",
"go-home": "Retourner en lieu sûr"
}
5 changes: 3 additions & 2 deletions src/routes/+error.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
import Mouse3DTilting from "$shells/Mouse3DTilting.svelte";
import { CodeBracket, Sparkles } from "@inqling/svelte-icons/heroicon-24-solid";
import { ExclamationCircle, XMark } from "@inqling/svelte-icons/heroicon-24-outline";
import { i } from "@inlang/sdk-js";
</script>

<svelte:head>
<title>Error {$page.status} | Emerald Studio</title>
<title>{i("errors.error")} {$page.status} | Emerald Studio</title>
</svelte:head>

<div
Expand Down Expand Up @@ -72,6 +73,6 @@
goto("/", { replaceState: true });
}}
>
Go back to a safe place
{i("errors.go-home")}
</Button>
</div>
34 changes: 8 additions & 26 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,14 @@
</div>
<div class="flex items-center gap-5 sm:gap-10">
<div
class="nav-items-container hidden items-center gap-10 duration-700 ease-out lg:flex"
class="hidden items-center gap-10 duration-700 ease-out lg:flex"
class:-mr-40={!showButton}
>
{#each navbarItems.filter(item => item.href.startsWith("#")) as item}
<button on:click={() => scrollTo(item.href)}>
<button
class="relative after:absolute after:-bottom-1.5 after:left-0 after:h-1 after:w-0 after:bg-dominant after:duration-300 after:content-[''] hover:after:w-full"
on:click={() => scrollTo(item.href)}
>
{item.name}
</button>
{/each}
Expand Down Expand Up @@ -187,10 +190,11 @@
<SlideOver bind:show={showSlideOver}>
<svelte:fragment slot="content">
<div
class="nav-items-container flex h-full flex-col items-center justify-center gap-20 text-4xl font-medium child:after:!-bottom-3 child:after:!h-2"
class="flex h-full flex-col items-center justify-center gap-20 text-4xl font-medium child:after:!-bottom-3 child:after:!h-2"
>
{#each navbarItems.filter((_item, index) => !(index === navbarItems.length - 1 && innerWidth >= tailwindXsScreen)) as item}
<button
class="relative after:absolute after:-bottom-1.5 after:left-0 after:h-1 after:w-0 after:bg-dominant after:duration-300 after:content-[''] hover:after:w-full"
class:text-dominant={!item.href.startsWith("#")}
on:click={() => {
showSlideOver = false;
Expand Down Expand Up @@ -255,7 +259,7 @@
<!-- Middle -->
{#if innerWidth >= tailwindXsScreen}
<button
class="absolute bottom-0 left-0 right-0 text-center"
class="absolute bottom-0 left-0 right-0 mx-auto w-fit text-center"
on:click={() => window.scrollTo({ top: 0, behavior: "smooth" })}
on:keypress={() => window.scrollTo({ top: 0, behavior: "smooth" })}
>
Expand Down Expand Up @@ -293,25 +297,3 @@
</div>
</div>
</footer>

<style lang="postcss">
:global(::selection) {
@apply bg-dominant/75 text-primary;
}
:global(body) {
@apply bg-primary text-primary;
}
.nav-items-container > * {
@apply relative;
}
.nav-items-container > *::after {
@apply absolute -bottom-1.5 left-0 h-1 w-0 bg-dominant duration-300 content-[""];
}
.nav-items-container > *:hover::after {
@apply w-full;
}
</style>
6 changes: 3 additions & 3 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,12 @@
setTimeout(() => {
element.style.removeProperty("transition-duration");
}, 500);
element.parentElement.style.transform = "scale(1.2)";
if (element.parentElement) element.parentElement.style.transform = "scale(1.2)";
}}
on:out_zone={e => {
const element = e.detail.element;
element.style.transitionDuration = "500ms";
element.parentElement.style.transform = "scale(1)";
if (element.parentElement) element.parentElement.style.transform = "scale(1)";
}}
>
<button
Expand Down Expand Up @@ -300,7 +300,7 @@
<div class="flex items-end justify-end">
<Button type="minimal" class="gap-2 text-end text-lg hover-child:translate-x-1">
{solutions.slice(-1)[0]?.description ?? ""}
<ChevronRight class="h-4 w-4 transition-transform duration-500" />
<ChevronRight class="h-4 w-4 min-w-max transition-transform duration-500" />
</Button>
</div>
</div>
Expand Down

0 comments on commit 5b5446f

Please sign in to comment.