Get, Set, Go!
Custom navigations for Solid, written in Typescript. Implement custom page transition logic and ✨ animations ✨.
Note: This package relies on solid-app-router.
npm install solid-custom-navigation --save
yarn add solid-custom-navigation ## or in yarnimport { Component } from 'solid-js'
import { useNavigate } from 'solid-app-router'
import { useNavigation } from 'solid-custom-navigation'
// And then in your component..
const Page: Component = () => {
const { get, set, go } = useCustomNavigation(useNavigate(), options)
return (
<div style={{ animation: get() }}></div>
)
}() => string
Get the current animation string.
Setter<'UNMOUNTED' | 'DEFAULT' | 'MOUNTED'>
Set the current component transition state.
async (to: string, opts?: Partial<NavigateOptions<unknown>> | undefined)
Navigate to a route. Pretty much an alias for navigate's props.
Accessor<'UNMOUNTED' | 'DEFAULT' | 'MOUNTED'>
Get the current component transition state.
UseNavigateOptions - OPTIONAL
Options for navigation.
() => void - OPTIONAL
This function runs onMount.
() => void - OPTIONAL
This function during a transition.
() => void - OPTIONAL
This function runs onCleanup.
number - OPTIONAL
The number of milliseconds to wait before navigating away (and calling onCleanup).
{ [ 'UNMOUNTED' | 'DEFAULT' | 'MOUNTED' ]: string } - OPTIONAL
Add custom animation strings.
Here's an example using keyframes from solid-styled-components to create a custom animation.
const customUnmountAnimation = keyframes``
const customMountAnimation = keyframes``
// And then later on..
useCustomNavigation(useNavigate(), {
UNMOUNTED: `${ customUnmountAnimation } 0.5s ease`,
MOUNTED: `${ customMountAnimation } 0.5s ease`
})MIT