mirror of
https://github.com/revoltchat/revite.git
synced 2024-12-26 07:22:10 -05:00
Hover animation for home button.
Fix svg alignment in foreign objects.
This commit is contained in:
parent
9581a4df92
commit
e1ffefe2ba
4 changed files with 27 additions and 3 deletions
|
@ -6,11 +6,13 @@ export interface IconBaseProps<T> {
|
||||||
attachment?: Attachment;
|
attachment?: Attachment;
|
||||||
|
|
||||||
size: number;
|
size: number;
|
||||||
|
hover?: boolean;
|
||||||
animate?: boolean;
|
animate?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IconModifiers {
|
interface IconModifiers {
|
||||||
square?: boolean;
|
square?: boolean;
|
||||||
|
hover?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default styled.svg<IconModifiers>`
|
export default styled.svg<IconModifiers>`
|
||||||
|
@ -27,6 +29,14 @@ export default styled.svg<IconModifiers>`
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
`}
|
`}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
${(props) =>
|
||||||
|
props.hover &&
|
||||||
|
css`
|
||||||
|
&:hover .icon {
|
||||||
|
filter: brightness(0.8);
|
||||||
|
}
|
||||||
|
`}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const ImageIconBase = styled.img<IconModifiers>`
|
export const ImageIconBase = styled.img<IconModifiers>`
|
||||||
|
@ -38,4 +48,12 @@ export const ImageIconBase = styled.img<IconModifiers>`
|
||||||
css`
|
css`
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
`}
|
`}
|
||||||
|
|
||||||
|
${(props) =>
|
||||||
|
props.hover &&
|
||||||
|
css`
|
||||||
|
&:hover img {
|
||||||
|
filter: brightness(0.8);
|
||||||
|
}
|
||||||
|
`}
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -63,6 +63,7 @@ export default observer(
|
||||||
status,
|
status,
|
||||||
animate,
|
animate,
|
||||||
mask,
|
mask,
|
||||||
|
hover,
|
||||||
children,
|
children,
|
||||||
as,
|
as,
|
||||||
...svgProps
|
...svgProps
|
||||||
|
@ -79,6 +80,7 @@ export default observer(
|
||||||
{...svgProps}
|
{...svgProps}
|
||||||
width={size}
|
width={size}
|
||||||
height={size}
|
height={size}
|
||||||
|
hover={hover}
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
viewBox="0 0 32 32">
|
viewBox="0 0 32 32">
|
||||||
<foreignObject
|
<foreignObject
|
||||||
|
@ -86,6 +88,7 @@ export default observer(
|
||||||
y="0"
|
y="0"
|
||||||
width="32"
|
width="32"
|
||||||
height="32"
|
height="32"
|
||||||
|
class="icon"
|
||||||
mask={mask ?? (status ? "url(#user)" : undefined)}>
|
mask={mask ?? (status ? "url(#user)" : undefined)}>
|
||||||
{<img src={iconURL} draggable={false} loading="lazy" />}
|
{<img src={iconURL} draggable={false} loading="lazy" />}
|
||||||
</foreignObject>
|
</foreignObject>
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
import { Plus } from "@styled-icons/boxicons-regular";
|
import { Plus } from "@styled-icons/boxicons-regular";
|
||||||
import { Compass } from "@styled-icons/boxicons-solid";
|
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import { useHistory, useLocation, useParams } from "react-router-dom";
|
import { useHistory, useLocation, useParams } from "react-router-dom";
|
||||||
import { RelationshipStatus } from "revolt-api/types/Users";
|
import { RelationshipStatus } from "revolt-api/types/Users";
|
||||||
import styled, { css } from "styled-components";
|
import styled, { css } from "styled-components";
|
||||||
|
|
||||||
import { attachContextMenu, openContextMenu } from "preact-context-menu";
|
import { attachContextMenu } from "preact-context-menu";
|
||||||
|
|
||||||
import ConditionalLink from "../../../lib/ConditionalLink";
|
import ConditionalLink from "../../../lib/ConditionalLink";
|
||||||
import PaintCounter from "../../../lib/PaintCounter";
|
import PaintCounter from "../../../lib/PaintCounter";
|
||||||
|
@ -18,7 +17,6 @@ import { Unreads } from "../../../redux/reducers/unreads";
|
||||||
import { useIntermediate } from "../../../context/intermediate/Intermediate";
|
import { useIntermediate } from "../../../context/intermediate/Intermediate";
|
||||||
import { useClient } from "../../../context/revoltjs/RevoltClient";
|
import { useClient } from "../../../context/revoltjs/RevoltClient";
|
||||||
|
|
||||||
import logoSVG from "../../../assets/logo.svg";
|
|
||||||
import ServerIcon from "../../common/ServerIcon";
|
import ServerIcon from "../../common/ServerIcon";
|
||||||
import Tooltip from "../../common/Tooltip";
|
import Tooltip from "../../common/Tooltip";
|
||||||
import UserHover from "../../common/user/UserHover";
|
import UserHover from "../../common/user/UserHover";
|
||||||
|
@ -267,6 +265,7 @@ export const ServerListSidebar = observer(({ unreads, lastOpened }: Props) => {
|
||||||
target={client.user}
|
target={client.user}
|
||||||
size={32}
|
size={32}
|
||||||
status
|
status
|
||||||
|
hover
|
||||||
/>
|
/>
|
||||||
</Icon>
|
</Icon>
|
||||||
</UserHover>
|
</UserHover>
|
||||||
|
|
|
@ -48,3 +48,7 @@ hr {
|
||||||
height: 1px;
|
height: 1px;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreignObject > svg {
|
||||||
|
vertical-align: top !important;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue