feat: add paste and clear icon
This commit is contained in:
parent
15ee1e531b
commit
ad228d53b7
@ -4,6 +4,8 @@ import { useLockFn } from "ahooks";
|
|||||||
import { useSetRecoilState } from "recoil";
|
import { useSetRecoilState } from "recoil";
|
||||||
import { Box, Button, Grid, IconButton, Stack, TextField } from "@mui/material";
|
import { Box, Button, Grid, IconButton, Stack, TextField } from "@mui/material";
|
||||||
import {
|
import {
|
||||||
|
ClearRounded,
|
||||||
|
ContentCopyRounded,
|
||||||
LocalFireDepartmentRounded,
|
LocalFireDepartmentRounded,
|
||||||
RefreshRounded,
|
RefreshRounded,
|
||||||
TextSnippetOutlined,
|
TextSnippetOutlined,
|
||||||
@ -194,6 +196,11 @@ const ProfilePage = () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const onCopyLink = async () => {
|
||||||
|
const text = await navigator.clipboard.readText();
|
||||||
|
if (text) setUrl(text);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BasePage
|
<BasePage
|
||||||
title={t("Profiles")}
|
title={t("Profiles")}
|
||||||
@ -240,6 +247,28 @@ const ProfilePage = () => {
|
|||||||
onChange={(e) => setUrl(e.target.value)}
|
onChange={(e) => setUrl(e.target.value)}
|
||||||
sx={{ input: { py: 0.65, px: 1.25 } }}
|
sx={{ input: { py: 0.65, px: 1.25 } }}
|
||||||
placeholder={t("Profile URL")}
|
placeholder={t("Profile URL")}
|
||||||
|
InputProps={{
|
||||||
|
sx: { pr: 1 },
|
||||||
|
endAdornment: !url ? (
|
||||||
|
<IconButton
|
||||||
|
size="small"
|
||||||
|
sx={{ p: 0.5 }}
|
||||||
|
title={t("Paste")}
|
||||||
|
onClick={onCopyLink}
|
||||||
|
>
|
||||||
|
<ContentCopyRounded fontSize="inherit" />
|
||||||
|
</IconButton>
|
||||||
|
) : (
|
||||||
|
<IconButton
|
||||||
|
size="small"
|
||||||
|
sx={{ p: 0.5 }}
|
||||||
|
title={t("Clear")}
|
||||||
|
onClick={() => setUrl("")}
|
||||||
|
>
|
||||||
|
<ClearRounded fontSize="inherit" />
|
||||||
|
</IconButton>
|
||||||
|
),
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
disabled={!url || disabled}
|
disabled={!url || disabled}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user