mirror of
https://github.com/revoltchat/revite.git
synced 2024-12-26 07:22:10 -05:00
Move details styling into its own component.
This commit is contained in:
parent
4e28470d2d
commit
1a08f50997
4 changed files with 32 additions and 29 deletions
28
src/components/ui/Details.tsx
Normal file
28
src/components/ui/Details.tsx
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import styled from "styled-components";
|
||||||
|
|
||||||
|
export default styled.details`
|
||||||
|
summary {
|
||||||
|
outline: none;
|
||||||
|
list-style: none;
|
||||||
|
transition: .2s opacity;
|
||||||
|
|
||||||
|
&::marker, &::-webkit-details-marker {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
svg {
|
||||||
|
flex-shrink: 0;
|
||||||
|
transition: .2s ease transform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:not([open]) {
|
||||||
|
summary {
|
||||||
|
opacity: .7;
|
||||||
|
}
|
||||||
|
|
||||||
|
summary svg {
|
||||||
|
transform: rotateZ(-90deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
|
@ -23,6 +23,7 @@ export default function TextAreaAutoSize(props: TextAreaAutoSizeProps) {
|
||||||
const ref = useRef<HTMLTextAreaElement>();
|
const ref = useRef<HTMLTextAreaElement>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (isTouchscreenDevice) return;
|
||||||
autoFocus && ref.current.focus();
|
autoFocus && ref.current.focus();
|
||||||
}, [value]);
|
}, [value]);
|
||||||
|
|
||||||
|
|
|
@ -39,33 +39,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
details {
|
|
||||||
summary {
|
|
||||||
outline: none;
|
|
||||||
list-style: none;
|
|
||||||
transition: .2s opacity;
|
|
||||||
|
|
||||||
&::marker, &::-webkit-details-marker {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
svg {
|
|
||||||
flex-shrink: 0;
|
|
||||||
transition: .2s ease transform;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&:not([open]) {
|
|
||||||
summary {
|
|
||||||
opacity: .7;
|
|
||||||
}
|
|
||||||
|
|
||||||
summary svg {
|
|
||||||
transform: rotateZ(-90deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&[data-empty="true"] {
|
&[data-empty="true"] {
|
||||||
img {
|
img {
|
||||||
height: 120px;
|
height: 120px;
|
||||||
|
|
|
@ -14,6 +14,7 @@ import { ChevronDown, ChevronRight, ListPlus } from "@styled-icons/boxicons-regu
|
||||||
import { UserDetail, MessageAdd, UserPlus } from "@styled-icons/boxicons-solid";
|
import { UserDetail, MessageAdd, UserPlus } from "@styled-icons/boxicons-solid";
|
||||||
import { TextReact } from "../../lib/i18n";
|
import { TextReact } from "../../lib/i18n";
|
||||||
import { Children } from "../../types/Preact";
|
import { Children } from "../../types/Preact";
|
||||||
|
import Details from "../../components/ui/Details";
|
||||||
|
|
||||||
export default function Friends() {
|
export default function Friends() {
|
||||||
const { openScreen } = useIntermediate();
|
const { openScreen } = useIntermediate();
|
||||||
|
@ -112,7 +113,7 @@ export default function Friends() {
|
||||||
if (list.length === 0) return;
|
if (list.length === 0) return;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<details open>
|
<Details open>
|
||||||
<summary>
|
<summary>
|
||||||
<Overline className={styles.overline} type="subtle">
|
<Overline className={styles.overline} type="subtle">
|
||||||
<ChevronDown size={20} />
|
<ChevronDown size={20} />
|
||||||
|
@ -122,7 +123,7 @@ export default function Friends() {
|
||||||
</Overline>
|
</Overline>
|
||||||
</summary>
|
</summary>
|
||||||
{ list.map(x => <Friend key={x._id} user={x} />) }
|
{ list.map(x => <Friend key={x._id} user={x} />) }
|
||||||
</details>
|
</Details>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue