fix: check button hover style

This commit is contained in:
GyDi 2022-04-10 03:33:17 +08:00
parent 3001c780bd
commit 0445f9dfc2
No known key found for this signature in database
GPG Key ID: 1C95E0D3467B3084

View File

@ -25,8 +25,9 @@ interface Props {
} }
const Widget = styled(Box)(() => ({ const Widget = styled(Box)(() => ({
padding: "4px 6px", padding: "3px 6px",
fontSize: 14, fontSize: 14,
borderRadius: "4px",
})); }));
const TypeBox = styled(Box)(({ theme }) => ({ const TypeBox = styled(Box)(({ theme }) => ({
@ -51,10 +52,7 @@ const ProxyItem = (props: Props) => {
} }
}, [proxy]); }, [proxy]);
const onDelay = useLockFn(async (e: any) => { const onDelay = useLockFn(async () => {
e.preventDefault();
e.stopPropagation();
return delayManager return delayManager
.checkDelay(proxy.name, groupName) .checkDelay(proxy.name, groupName)
.then((result) => setDelay(result)) .then((result) => setDelay(result))
@ -107,13 +105,27 @@ const ProxyItem = (props: Props) => {
<ListItemIcon <ListItemIcon
sx={{ justifyContent: "flex-end", color: "primary.main" }} sx={{ justifyContent: "flex-end", color: "primary.main" }}
> >
<Widget className="the-check" onClick={onDelay}> <Widget
className="the-check"
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
onDelay();
}}
sx={(theme) => ({
":hover": { bgcolor: alpha(theme.palette.primary.main, 0.15) },
})}
>
Check Check
</Widget> </Widget>
<Widget <Widget
className="the-delay" className="the-delay"
onClick={onDelay} onClick={(e) => {
e.preventDefault();
e.stopPropagation();
onDelay();
}}
color={ color={
delay > 500 delay > 500
? "error.main" ? "error.main"
@ -121,6 +133,9 @@ const ProxyItem = (props: Props) => {
? "success.main" ? "success.main"
: "text.secondary" : "text.secondary"
} }
sx={(theme) => ({
":hover": { bgcolor: alpha(theme.palette.primary.main, 0.15) },
})}
> >
{delay > 1e5 ? "Error" : delay > 3000 ? "Timeout" : `${delay}ms`} {delay > 1e5 ? "Error" : delay > 3000 ? "Timeout" : `${delay}ms`}
</Widget> </Widget>