mirror of
https://github.com/ershisan99/DevToysWeb.git
synced 2026-01-31 20:52:11 +00:00
refactor: memoize icons on export
This commit is contained in:
@@ -83,11 +83,9 @@ export default function Page() {
|
||||
const onJsonChange: EditorProps["onChange"] = value => setJsonReactively(value ?? "");
|
||||
const onYamlChange: EditorProps["onChange"] = value => setYamlReactively(value ?? "");
|
||||
|
||||
const indentationIcon = useMemo(() => <icons.Space size={24} className="-translate-y-1.5" />, []);
|
||||
|
||||
const indentationConfig = (
|
||||
<Configuration
|
||||
icon={indentationIcon}
|
||||
icon={<icons.Space size={24} className="-translate-y-1.5" />}
|
||||
title="Indentation"
|
||||
control={
|
||||
<Select value={form.indentation} onValueChange={onIndentationChange}>
|
||||
|
||||
@@ -58,12 +58,10 @@ export default function Page() {
|
||||
const onOctChange: InputProps["onChange"] = ({ currentTarget: { value } }) => trySetOct(value);
|
||||
const onBinChange: InputProps["onChange"] = ({ currentTarget: { value } }) => trySetBin(value);
|
||||
|
||||
const formatNumberIcon = useMemo(() => <icons.CaseSensitive size={24} />, []);
|
||||
|
||||
const formatNumberConfig = useMemo(
|
||||
() => (
|
||||
<Configuration
|
||||
icon={formatNumberIcon}
|
||||
icon={<icons.CaseSensitive size={24} />}
|
||||
title="Format number"
|
||||
control={
|
||||
<LabeledSwitch
|
||||
@@ -76,7 +74,7 @@ export default function Page() {
|
||||
}
|
||||
/>
|
||||
),
|
||||
[format, formatNumberIcon]
|
||||
[format]
|
||||
);
|
||||
|
||||
const decPasteButton = useMemo(() => <PasteButton onClipboardRead={trySetDec} />, [trySetDec]);
|
||||
|
||||
Reference in New Issue
Block a user