Skip to content

Commit

Permalink
Merge pull request #168 from zhengkyl/master
Browse files Browse the repository at this point in the history
update solid examples to fix #121
  • Loading branch information
justin-schroeder committed Nov 3, 2023
2 parents 8318a37 + 02e182c commit 6989fd6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
10 changes: 4 additions & 6 deletions docs/src/examples/dropdown/dropdown-solid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@ import { createSignal, Show } from "solid-js"

const Dropdown = () => {
const [show, setShow] = createSignal(false)
const reveal = () => setShow(!show)
const reveal = () => setShow(!show())

let parent: HTMLDivElement

createAutoAnimate(() => parent /* optional config */)
const [parent, setEnabled] = createAutoAnimate(/* optional config */)

return (
<div ref={parent}>
<strong className="dropdown-label" onClick={reveal}>
<strong class="dropdown-label" onClick={reveal}>
Click me to open!
</strong>
<Show when={show()} keyed>
<p className="dropdown-content">Lorum ipsum...</p>
<p class="dropdown-content">Lorum ipsum...</p>
</Show>
</div>
)
Expand Down
5 changes: 1 addition & 4 deletions docs/src/examples/intro/intro-solid.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { createAutoAnimate } from '@formkit/auto-animate/solid'

function MyList () {
let animationParent;

createAutoAnimate(() => animationParent, /* optional config */)

const [animationParent] = createAutoAnimate()
return (
<ul ref={animationParent}>
{/* 🪄 Magic animations for your list */}
Expand Down
8 changes: 3 additions & 5 deletions docs/src/examples/solid/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ const solidPrimitive = {
solid: {
language: "tsx",
ext: "tsx",
example: `import { createSignal, For, Show } from "solid-js"
import { createAutoAnimate } from "@formkit/auto-animate/solid"
example: `import { createSignal, For, Show } from 'solid-js'
import { createAutoAnimate } from '@formkit/auto-animate/solid'
const App = function () {
let parent: HTMLDivElement
const [parent, setEnabled] = createAutoAnimate(/* optional config */)
const menuItems = ["Home", "Settings", "Logout"]
Expand Down Expand Up @@ -41,7 +40,7 @@ const solidDirective = {
solid: {
language: "tsx",
ext: "tsx",
example: `import { createSignal } from 'solid-js'
example: `import { createSignal, For, Show } from 'solid-js'
import { createAutoAnimateDirective } from '@formkit/auto-animate/solid'
const App = function () {
Expand All @@ -67,7 +66,6 @@ const App = function () {
</button>
</div>
</div>
</>
}
export default App`,
Expand Down

1 comment on commit 6989fd6

@vercel
Copy link

@vercel vercel bot commented on 6989fd6 Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.