forked from abner/for-legacy-web
feat: provide and consume scroll offsets
This commit is contained in:
@@ -45,7 +45,7 @@ const StatusBar = styled.div`
|
||||
}
|
||||
`;
|
||||
|
||||
const Routes = styled.div`
|
||||
const Routes = styled.div.attrs({ "data-component": "routes" })`
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -29,20 +29,17 @@ import ChannelHeader from "./ChannelHeader";
|
||||
import { MessageArea } from "./messaging/MessageArea";
|
||||
import VoiceHeader from "./voice/VoiceHeader";
|
||||
|
||||
const ChannelMain = styled.div`
|
||||
const ChannelMain = styled.div.attrs({ "data-component": "channel" })`
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
flex-direction: row;
|
||||
|
||||
> * > ::-webkit-scrollbar-thumb {
|
||||
background-clip: content-box;
|
||||
border-top: 48px solid transparent;
|
||||
}
|
||||
`;
|
||||
|
||||
const ChannelContent = styled.div`
|
||||
const ChannelContent = styled.div.attrs({
|
||||
"data-component": "content",
|
||||
})`
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
|
||||
@@ -78,7 +78,6 @@ const Info = styled.div`
|
||||
|
||||
export default observer(({ channel }: ChannelHeaderProps) => {
|
||||
const { openScreen } = useIntermediate();
|
||||
const layout = useApplicationState().layout;
|
||||
|
||||
const name = getChannelName(channel);
|
||||
let icon, recipient: User | undefined;
|
||||
@@ -99,7 +98,7 @@ export default observer(({ channel }: ChannelHeaderProps) => {
|
||||
}
|
||||
|
||||
return (
|
||||
<PageHeader icon={icon}>
|
||||
<PageHeader icon={icon} transparent>
|
||||
<Info>
|
||||
<span className="name">{name}</span>
|
||||
{isTouchscreenDevice &&
|
||||
|
||||
@@ -30,7 +30,7 @@ export default function HeaderActions({ channel }: ChannelHeaderProps) {
|
||||
const history = useHistory();
|
||||
|
||||
function openRightSidebar() {
|
||||
const panels = document.querySelector("#app > div > div");
|
||||
const panels = document.querySelector("#app > div > div > div");
|
||||
panels?.scrollTo({
|
||||
behavior: "smooth",
|
||||
left: panels.clientWidth * 3,
|
||||
@@ -84,7 +84,11 @@ export default function HeaderActions({ channel }: ChannelHeaderProps) {
|
||||
)}
|
||||
{(channel.channel_type === "Group" ||
|
||||
channel.channel_type === "TextChannel") && (
|
||||
<IconButton onClick={openSidebar}>
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
internalEmit("RightSidebar", "open", undefined);
|
||||
openRightSidebar();
|
||||
}}>
|
||||
<Group size={25} />
|
||||
</IconButton>
|
||||
)}
|
||||
|
||||
@@ -33,14 +33,18 @@ import Preloader from "../../../components/ui/Preloader";
|
||||
import ConversationStart from "./ConversationStart";
|
||||
import MessageRenderer from "./MessageRenderer";
|
||||
|
||||
const Area = styled.div`
|
||||
const Area = styled.div.attrs({ "data-scroll-offset": "with-padding" })`
|
||||
height: 100%;
|
||||
flex-grow: 1;
|
||||
min-height: 0;
|
||||
word-break: break-word;
|
||||
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
padding-top: 48px;
|
||||
word-break: break-word;
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
min-height: 150px;
|
||||
}
|
||||
|
||||
> div {
|
||||
display: flex;
|
||||
|
||||
@@ -29,7 +29,7 @@ export default function Developer() {
|
||||
return (
|
||||
<div>
|
||||
<PageHeader icon={<Wrench size="24" />}>Developer Tab</PageHeader>
|
||||
<div style={{ padding: "16px", paddingTop: "56px" }}>
|
||||
<div style={{ padding: "16px" }}>
|
||||
<PaintCounter always />
|
||||
</div>
|
||||
<div style={{ padding: "16px" }}>
|
||||
|
||||
@@ -12,9 +12,7 @@
|
||||
|
||||
.list {
|
||||
padding: 0 10px 10px 10px;
|
||||
padding-top: 48px;
|
||||
user-select: none;
|
||||
/*overflow-y: scroll;*/
|
||||
|
||||
&[data-empty="true"] {
|
||||
img {
|
||||
@@ -186,12 +184,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Hide the remove friend button on smaller screens.
|
||||
@media only screen and (max-width: 768px) {
|
||||
.list {
|
||||
padding: 56px 8px 8px 8px;
|
||||
|
||||
.remove {
|
||||
display: none;
|
||||
}
|
||||
.list .remove {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import { User } from "revolt.js/dist/maps/Users";
|
||||
import styled, { css } from "styled-components";
|
||||
|
||||
import styles from "./Friend.module.scss";
|
||||
import classNames from "classnames";
|
||||
import { Text } from "preact-i18n";
|
||||
|
||||
import { TextReact } from "../../lib/i18n";
|
||||
@@ -17,32 +18,12 @@ import { useClient } from "../../context/revoltjs/RevoltClient";
|
||||
import CollapsibleSection from "../../components/common/CollapsibleSection";
|
||||
import Tooltip from "../../components/common/Tooltip";
|
||||
import UserIcon from "../../components/common/user/UserIcon";
|
||||
import Header, { PageHeader } from "../../components/ui/Header";
|
||||
import { PageHeader } from "../../components/ui/Header";
|
||||
import IconButton from "../../components/ui/IconButton";
|
||||
|
||||
import { Children } from "../../types/Preact";
|
||||
import { Friend } from "./Friend";
|
||||
|
||||
const Container = styled.div`
|
||||
overflow-y: scroll;
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
min-height: 100px;
|
||||
width: 4px;
|
||||
background-clip: content-box;
|
||||
border-top: 48px solid transparent;
|
||||
}
|
||||
${() =>
|
||||
isTouchscreenDevice &&
|
||||
css`
|
||||
::-webkit-scrollbar-thumb {
|
||||
min-height: 150px;
|
||||
border-top: 56px solid transparent;
|
||||
border-bottom: var(--bottom-navigation-height) solid transparent;
|
||||
}
|
||||
`}
|
||||
`;
|
||||
|
||||
export default observer(() => {
|
||||
const { openScreen } = useIntermediate();
|
||||
|
||||
@@ -93,7 +74,7 @@ export default observer(() => {
|
||||
const isEmpty = lists.reduce((p: number, n) => p + n.length, 0) === 0;
|
||||
return (
|
||||
<>
|
||||
<PageHeader icon={<UserDetail size={24} />} noBurger>
|
||||
<PageHeader icon={<UserDetail size={24} />} transparent noBurger>
|
||||
<div className={styles.title}>
|
||||
<Text id="app.navigation.tabs.friends" />
|
||||
</div>
|
||||
@@ -136,9 +117,9 @@ export default observer(() => {
|
||||
*/}
|
||||
</div>
|
||||
</PageHeader>
|
||||
<Container>
|
||||
<div data-scroll-offset="true" data-avoids-navigation="true">
|
||||
<div
|
||||
className={styles.list}
|
||||
className={classNames(styles.list, "with-padding")}
|
||||
data-empty={isEmpty}
|
||||
data-mobile={isTouchscreenDevice}>
|
||||
{isEmpty && (
|
||||
@@ -234,7 +215,7 @@ export default observer(() => {
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</Container>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -83,7 +83,7 @@ export default observer(() => {
|
||||
</div>
|
||||
)}
|
||||
<div className="content">
|
||||
<PageHeader icon={<HomeIcon size={24} />}>
|
||||
<PageHeader icon={<HomeIcon size={24} />} transparent>
|
||||
<Text id="app.navigation.tabs.home" />
|
||||
</PageHeader>
|
||||
<div className={styles.homeScreen}>
|
||||
|
||||
@@ -102,7 +102,7 @@ export function GenericSettings({
|
||||
/>
|
||||
</Helmet>
|
||||
{isTouchscreenDevice && (
|
||||
<Header placement="primary">
|
||||
<Header placement="primary" transparent>
|
||||
{typeof page === "undefined" ? (
|
||||
<>
|
||||
{showExitButton && (
|
||||
@@ -168,6 +168,9 @@ export function GenericSettings({
|
||||
<div className={styles.content}>
|
||||
<div
|
||||
className={styles.scrollbox}
|
||||
data-scroll-offset={
|
||||
isTouchscreenDevice ? "with-padding" : undefined
|
||||
}
|
||||
ref={(ref) => {
|
||||
// Force scroll to top if page changes.
|
||||
if (ref) {
|
||||
|
||||
@@ -43,20 +43,13 @@
|
||||
background: var(--primary-background);
|
||||
}
|
||||
|
||||
.scrollbox {
|
||||
&::-webkit-scrollbar-thumb {
|
||||
min-height: 150px;
|
||||
border-top: 56px solid transparent;
|
||||
//border-bottom: var(--bottom-navigation-height) solid transparent;
|
||||
}
|
||||
}
|
||||
|
||||
/* Sidebar */
|
||||
.sidebar {
|
||||
overflow-y: auto;
|
||||
|
||||
.container {
|
||||
padding: 76px 8px calc(var(--bottom-navigation-height) + 30px);
|
||||
padding: calc(var(--header-height) + 4px) 8px
|
||||
calc(var(--bottom-navigation-height) + 30px);
|
||||
min-width: 218px;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user