mirror of
https://github.com/revoltchat/revite.git
synced 2024-12-25 07:02: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;
|
||||
|
||||
size: number;
|
||||
hover?: boolean;
|
||||
animate?: boolean;
|
||||
}
|
||||
|
||||
interface IconModifiers {
|
||||
square?: boolean;
|
||||
hover?: boolean;
|
||||
}
|
||||
|
||||
export default styled.svg<IconModifiers>`
|
||||
|
@ -27,6 +29,14 @@ export default styled.svg<IconModifiers>`
|
|||
border-radius: 50%;
|
||||
`}
|
||||
}
|
||||
|
||||
${(props) =>
|
||||
props.hover &&
|
||||
css`
|
||||
&:hover .icon {
|
||||
filter: brightness(0.8);
|
||||
}
|
||||
`}
|
||||
`;
|
||||
|
||||
export const ImageIconBase = styled.img<IconModifiers>`
|
||||
|
@ -38,4 +48,12 @@ export const ImageIconBase = styled.img<IconModifiers>`
|
|||
css`
|
||||
border-radius: 50%;
|
||||
`}
|
||||
|
||||
${(props) =>
|
||||
props.hover &&
|
||||
css`
|
||||
&:hover img {
|
||||
filter: brightness(0.8);
|
||||
}
|
||||
`}
|
||||
`;
|
||||
|
|
|
@ -63,6 +63,7 @@ export default observer(
|
|||
status,
|
||||
animate,
|
||||
mask,
|
||||
hover,
|
||||
children,
|
||||
as,
|
||||
...svgProps
|
||||
|
@ -79,6 +80,7 @@ export default observer(
|
|||
{...svgProps}
|
||||
width={size}
|
||||
height={size}
|
||||
hover={hover}
|
||||
aria-hidden="true"
|
||||
viewBox="0 0 32 32">
|
||||
<foreignObject
|
||||
|
@ -86,6 +88,7 @@ export default observer(
|
|||
y="0"
|
||||
width="32"
|
||||
height="32"
|
||||
class="icon"
|
||||
mask={mask ?? (status ? "url(#user)" : undefined)}>
|
||||
{<img src={iconURL} draggable={false} loading="lazy" />}
|
||||
</foreignObject>
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import { Plus } from "@styled-icons/boxicons-regular";
|
||||
import { Compass } from "@styled-icons/boxicons-solid";
|
||||
import { observer } from "mobx-react-lite";
|
||||
import { useHistory, useLocation, useParams } from "react-router-dom";
|
||||
import { RelationshipStatus } from "revolt-api/types/Users";
|
||||
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 PaintCounter from "../../../lib/PaintCounter";
|
||||
|
@ -18,7 +17,6 @@ import { Unreads } from "../../../redux/reducers/unreads";
|
|||
import { useIntermediate } from "../../../context/intermediate/Intermediate";
|
||||
import { useClient } from "../../../context/revoltjs/RevoltClient";
|
||||
|
||||
import logoSVG from "../../../assets/logo.svg";
|
||||
import ServerIcon from "../../common/ServerIcon";
|
||||
import Tooltip from "../../common/Tooltip";
|
||||
import UserHover from "../../common/user/UserHover";
|
||||
|
@ -267,6 +265,7 @@ export const ServerListSidebar = observer(({ unreads, lastOpened }: Props) => {
|
|||
target={client.user}
|
||||
size={32}
|
||||
status
|
||||
hover
|
||||
/>
|
||||
</Icon>
|
||||
</UserHover>
|
||||
|
|
|
@ -48,3 +48,7 @@ hr {
|
|||
height: 1px;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
foreignObject > svg {
|
||||
vertical-align: top !important;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue