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