mirror of
https://github.com/ershisan99/DevToysWeb.git
synced 2025-12-17 12:32:56 +00:00
feat: add number base converter
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { AutoFixHigh } from "@mui/icons-material";
|
||||
import { FormControlLabel, Switch } from "@mui/material";
|
||||
import { SwitchBaseProps } from "@mui/material/internal/SwitchBase";
|
||||
import { memo } from "react";
|
||||
|
||||
import { Configurations } from "@/components/common";
|
||||
|
||||
type SwitchChecked = NonNullable<SwitchBaseProps["checked"]>;
|
||||
type OnSwitchChange = NonNullable<SwitchBaseProps["onChange"]>;
|
||||
|
||||
type Props = {
|
||||
format: SwitchChecked;
|
||||
onFormatChange: OnSwitchChange;
|
||||
};
|
||||
|
||||
const StyledComponent = ({ format, onFormatChange }: Props) => (
|
||||
<Configurations
|
||||
configurations={[
|
||||
{
|
||||
icon: <AutoFixHigh />,
|
||||
title: "Format number",
|
||||
input: (
|
||||
<FormControlLabel
|
||||
labelPlacement="start"
|
||||
label={format ? "On" : "Off"}
|
||||
control={<Switch checked={format} onChange={onFormatChange} />}
|
||||
/>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
|
||||
export const Component = memo(StyledComponent);
|
||||
|
||||
export default Component;
|
||||
Reference in New Issue
Block a user