fix spacing

This commit is contained in:
Domin-MND
2023-10-31 20:14:57 +03:00
parent 5674e3c1b6
commit 6c71073d10

View File

@@ -22,51 +22,52 @@ pnpm add reacord react discord.js
## Example
<!-- prettier-ignore -->
```tsx
import { useState } from "react"
import { Embed, EmbedField, Button } from "reacord"
interface EmbedCounterProps {
count: number
visible: boolean
count: number
visible: boolean
}
function EmbedCounter({ count, visible }: EmbedCounterProps) {
if (!visible) return <></>
if (!visible) return <></>
return (
<Embed title="the counter">
<EmbedField name="is it even?">{count % 2 ? "no" : "yes"}</EmbedField>
</Embed>
)
return (
<Embed title="the counter">
<EmbedField name="is it even?">{count % 2 ? "no" : "yes"}</EmbedField>
</Embed>
)
}
function Counter() {
const [showEmbed, setShowEmbed] = useState<boolean>(false)
const [count, setCount] = useState<number>(0)
const instance = useInstance()
const [showEmbed, setShowEmbed] = useState<boolean>(false)
const [count, setCount] = useState<number>(0)
const instance = useInstance()
return (
<>
this button was clicked {count} times
<EmbedCounter count={count} visible={showEmbed} />
<Button
style="primary"
label="clicc"
onClick={() => setCount(count + 1)}
/>
<Button
style="secondary"
label={showEmbed ? "hide embed" : "show embed"}
onClick={() => setShowEmbed(!showEmbed)}
/>
<Button
style="danger"
label="deactivate"
onClick={() => instance.destroy()}
/>
</>
)
return (
<>
this button was clicked {count} times
<EmbedCounter count={count} visible={showEmbed} />
<Button
style="primary"
label="clicc"
onClick={() => setCount(count + 1)}
/>
<Button
style="secondary"
label={showEmbed ? "hide embed" : "show embed"}
onClick={() => setShowEmbed(!showEmbed)}
/>
<Button
style="danger"
label="deactivate"
onClick={() => instance.destroy()}
/>
</>
)
}
```