-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Moved back to scrolling portfolio - Mobile first components - Missing content for experience and contact - Need to fix project card to become a grid when there's space
- Loading branch information
1 parent
7834f58
commit be646f2
Showing
18 changed files
with
508 additions
and
41 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<script lang="ts"> | ||
import { Motion } from "svelte-motion"; | ||
import { cva, type VariantProps } from "class-variance-authority"; | ||
import { cn } from "$lib/utils"; | ||
interface DockProps extends VariantProps<typeof dockVariants> { | ||
className?: string; | ||
magnification?: number; | ||
distance?: number; | ||
direction?: "top" | "middle" | "bottom"; | ||
} | ||
let className: DockProps["className"] = undefined; | ||
export { className as class }; | ||
export let magnification: DockProps["magnification"] = 60; | ||
export let distance: DockProps["distance"] = 140; | ||
export let direction: DockProps["direction"] = "middle"; | ||
const dockVariants = cva( | ||
"mx-auto w-max mt-8 h-[58px] p-2 flex gap-2 rounded-2xl border supports-backdrop-blur:bg-white/10 supports-backdrop-blur:dark:bg-black/10 backdrop-blur-md" | ||
); | ||
let dockElement: HTMLDivElement; | ||
let mouseX = Infinity; | ||
function handleMouseMove(e: MouseEvent) { | ||
mouseX = e.pageX; | ||
} | ||
function handleMouseLeave() { | ||
mouseX = Infinity; | ||
} | ||
let dockClass = cn(dockVariants({ className }), { | ||
"items-start": direction === "top", | ||
"items-center": direction === "middle", | ||
"items-end": direction === "bottom", | ||
}); | ||
</script> | ||
|
||
<Motion let:motion> | ||
<!-- svelte-ignore a11y-no-static-element-interactions --> | ||
<div | ||
use:motion | ||
bind:this={dockElement} | ||
on:mousemove={(e) => handleMouseMove(e)} | ||
on:mouseleave={handleMouseLeave} | ||
class={dockClass} | ||
> | ||
<slot {mouseX} {magnification} {distance}> | ||
<!-- Your Content --> | ||
Default | ||
</slot> | ||
</div> | ||
</Motion> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<script lang="ts"> | ||
import { cn } from "$lib/utils"; | ||
import { | ||
Motion, | ||
useMotionValue, | ||
useSpring, | ||
useTransform, | ||
} from "svelte-motion"; | ||
export let magnification = 60; | ||
export let distance = 160; | ||
export let mouseX = 0; | ||
let mint = useMotionValue(mouseX); | ||
$: mint.set(mouseX); | ||
let className: string | undefined = ""; | ||
export { className as class }; | ||
let iconElement: HTMLDivElement; | ||
let distanceCalc = useTransform(mint, (val: number) => { | ||
const bounds = iconElement?.getBoundingClientRect() ?? { x: 0, width: 0 }; | ||
return val - bounds.x - bounds.width / 2; | ||
}); | ||
let widthSync = useTransform( | ||
distanceCalc, | ||
[-distance, 0, distance], | ||
[38, magnification, 38] | ||
); | ||
let width = useSpring(widthSync, { | ||
mass: 0.1, | ||
stiffness: 150, | ||
damping: 12, | ||
}); | ||
let iconClass = cn( | ||
"flex aspect-square cursor-pointer items-center justify-center rounded-full", | ||
className | ||
); | ||
</script> | ||
|
||
<Motion style={{ width: width }} let:motion> | ||
<div use:motion bind:this={iconElement} class={iconClass}> | ||
<slot></slot> | ||
</div> | ||
</Motion> |
Oops, something went wrong.