Skip to content

Commit

Permalink
docs: tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
BobbieGoede committed Oct 9, 2024
1 parent 66afff7 commit 567d3cd
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docs/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,21 @@ export default defineAppConfig({
},
},
ul: {
initial: { x: 100, opacity: 0 },
visibleOnce: { x: 0, opacity: 1 },
initial: { x: 100, y: 100, opacity: 0 },
visibleOnce: { x: 0, y: 0, opacity: 1 },
},
li: {
initial: { x: 100, opacity: 0 },
initial: { x: 40, y: 20, opacity: 0 },
hovered: {
x: 10,
opacity: 1,
transition: { mass: 0.5, damping: 5, delay: 0 },
transition: { mass: 1, delay: 0 },
},
visibleOnce: {
x: 0,
y: 0,
opacity: 1,
transition: { mass: 0.5, damping: 5 },
transition: { mass: 1 },
},
},
headers: {
Expand Down
34 changes: 34 additions & 0 deletions docs/components/content/ProseOl.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
export default defineComponent({
setup() {
const MotionComponent = resolveComponent('Motion')
const slots = useSlots()
const appConfig = useAppConfig()

return () => {
const nodes: VNode[] = slots.default?.() || []

return h(
'ol',
{
...appConfig.motions.ul,
},
nodes.map((node, i) => {
node.props = {
is: 'li',
...appConfig.motions.li,
visibleOnce: {
...appConfig.motions.li.visibleOnce,
transition: {
...appConfig.motions.li.visibleOnce.transition,
delay: i * 50,
},
},
}

// @ts-expect-error type conflict but seems to work fine
return h(MotionComponent, { ...node.props }, node.children)
}),
)
}
},
})

0 comments on commit 567d3cd

Please sign in to comment.