tring to put token
This commit is contained in:
@@ -7,7 +7,7 @@ import { useState, ReactNode } from "react";
|
||||
interface ToggleOption {
|
||||
key: string;
|
||||
label: string;
|
||||
content: ReactNode;
|
||||
content: ReactNode | (() => ReactNode);
|
||||
}
|
||||
|
||||
interface ToggleProps {
|
||||
@@ -46,7 +46,15 @@ export default function Toggle({ options, defaultView }: ToggleProps) {
|
||||
</div>
|
||||
|
||||
<div className="padding toggleContent">
|
||||
{options.find((opt) => opt.key === view)?.content}
|
||||
{(() => {
|
||||
const active = options.find((opt) => opt.key === view)?.content;
|
||||
|
||||
if (typeof active === "function") {
|
||||
return active();
|
||||
}
|
||||
|
||||
return active;
|
||||
})()}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user