-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overall improvements #212
Overall improvements #212
Conversation
Not a fan of the Inlang localization step in load functions but yeah...
10x faster build time 8x less modules to transform
- Improve callback handling (in a very smart way tbh) - Fix click outside not closing it - Fix "undefined" in the DOM - Fix useless use of svelte:fragment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explanation of that very special component communication mechanism. It allows for a JS callback, within the markup, without any content in the <script>
tag.
I don't know what we can do with the let:
syntax, but we might even be able to bind something from the +page
's <script>
to the prop, allowing for an in-place regular callback usage.
*/ | ||
export let afterClose: () => void = () => {}; | ||
const onCloseStore = writable(() => {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Creating a store that contains a function, initialized with nothing
</div> | ||
{/if} | ||
<div class="-my-6 h-full"> | ||
<slot onClose={onCloseStore} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Passing it as a slot prop, so we can use the
let:
directive
{item.name} | ||
</button> | ||
{/each} | ||
<SlideOver bind:show={showSlideOver} let:onClose> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Get the store as a prop
on:click={() => { | ||
slideOverCloseCallback = () => goto("/contact"); | ||
onClose.set(async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Set it to any value we want inside the callback (a simple function wouldn't be editable otherwise, we can't even use the
$onClose = () => {}
syntax)
leave="ease-in-out duration-500 sm:duration-700" | ||
leaveFrom="translate-x-0" | ||
leaveTo="translate-x-full" | ||
on:outroend={$onCloseStore} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Finally, execute the store's function whenever we want on the parent component, with our custom content!
(Short foron:outroend={() => $onCloseStore()}
)
Use absolute instead of junky negative margins, fixing every issue it had. Same change for the magnetic arrow. For the hero content (text and right art), define its size to 80svh, which is enough to make it feel centered without having any impact on neither the magnetic arrow nor the background.
- Remove the need for 2 texts for title and subtitle - Improve background sizing - Improve and fix magnetic arrow positioning
- Remove 2 unnecessary goto in favor of "a" tags - Fix logic of detecting active link with the new Inlang paths
Main changes
+layout.svelte
to avoid duplication and use an inheritance mechanism insteadNote
I'm not a fan of the need to manually tell Inlang which language to use inside
load
functions, I don't know if it's a bug.It doesn't alter the behavior of anything, it's just extra verbose for nothing
tailwind-merge
instead of a dirty manual concatenation within componentsSlideOver
not being dismissable with a click outsideOther changes
eslint .
at each commit though)0.x
at least)text-pretty
on all main<p>
s we got for a nicer lookscroll-smooth
on navigationgoto()
s in favor of direct<a>
tags (little follow-up of Convert buttons to links automatically for better accessibility #205)<slot />
by props forSection
's titleSlideOver
:svelte:fragment
sitemap.xml
, allowing for a cleaner code and the removal of@types/node
robots.txt
, allowing us to use theROOT_URL
variable instead of hardcoding itThings I wish I could fix