fix(core): implement pricing plans scroll area with radix (#4824)
This commit is contained in:
@@ -13,15 +13,26 @@ export const scrollArea = style({
|
|||||||
overflowX: 'auto',
|
overflowX: 'auto',
|
||||||
scrollSnapType: 'x mandatory',
|
scrollSnapType: 'x mandatory',
|
||||||
paddingBottom: '21px',
|
paddingBottom: '21px',
|
||||||
|
});
|
||||||
|
|
||||||
'::-webkit-scrollbar': {
|
export const scrollBar = style({
|
||||||
display: 'block',
|
display: 'flex',
|
||||||
height: '5px',
|
alignItems: 'center',
|
||||||
background: 'transparent',
|
userSelect: 'none',
|
||||||
},
|
touchAction: 'none',
|
||||||
'::-webkit-scrollbar-thumb': {
|
height: '9px',
|
||||||
|
width: '100%',
|
||||||
|
});
|
||||||
|
|
||||||
|
export const scrollThumb = style({
|
||||||
background: 'var(--affine-icon-secondary)',
|
background: 'var(--affine-icon-secondary)',
|
||||||
borderRadius: '5px',
|
opacity: 0.6,
|
||||||
|
overflow: 'hidden',
|
||||||
|
height: '4px',
|
||||||
|
borderRadius: '4px',
|
||||||
|
|
||||||
|
vars: {
|
||||||
|
'--radix-scroll-area-thumb-height': '4px',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { SettingHeader } from '@affine/component/setting-components';
|
import { SettingHeader } from '@affine/component/setting-components';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { ArrowRightBigIcon } from '@blocksuite/icons';
|
import { ArrowRightBigIcon } from '@blocksuite/icons';
|
||||||
|
import * as ScrollArea from '@radix-ui/react-scroll-area';
|
||||||
import type { HtmlHTMLAttributes, ReactNode } from 'react';
|
import type { HtmlHTMLAttributes, ReactNode } from 'react';
|
||||||
|
|
||||||
import * as styles from './layout.css';
|
import * as styles from './layout.css';
|
||||||
@@ -49,9 +50,18 @@ export const PlanLayout = ({
|
|||||||
subtitle={subtitle}
|
subtitle={subtitle}
|
||||||
/>
|
/>
|
||||||
{tabs}
|
{tabs}
|
||||||
<div ref={scrollRef} className={styles.scrollArea}>
|
<ScrollArea.Root>
|
||||||
|
<ScrollArea.Viewport ref={scrollRef} className={styles.scrollArea}>
|
||||||
{scroll}
|
{scroll}
|
||||||
</div>
|
</ScrollArea.Viewport>
|
||||||
|
<ScrollArea.Scrollbar
|
||||||
|
forceMount
|
||||||
|
orientation="horizontal"
|
||||||
|
className={styles.scrollBar}
|
||||||
|
>
|
||||||
|
<ScrollArea.Thumb className={styles.scrollThumb}></ScrollArea.Thumb>
|
||||||
|
</ScrollArea.Scrollbar>
|
||||||
|
</ScrollArea.Root>
|
||||||
{footer}
|
{footer}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|||||||
import { ContactWithUsIcon } from '@blocksuite/icons';
|
import { ContactWithUsIcon } from '@blocksuite/icons';
|
||||||
import { Modal, type ModalProps } from '@toeverything/components/modal';
|
import { Modal, type ModalProps } from '@toeverything/components/modal';
|
||||||
import { debounce } from 'lodash-es';
|
import { debounce } from 'lodash-es';
|
||||||
import { Suspense, useCallback, useEffect, useRef } from 'react';
|
import { Suspense, useCallback, useLayoutEffect, useRef } from 'react';
|
||||||
|
|
||||||
import { useCurrentLoginStatus } from '../../../hooks/affine/use-current-login-status';
|
import { useCurrentLoginStatus } from '../../../hooks/affine/use-current-login-status';
|
||||||
import { AccountSetting } from './account-setting';
|
import { AccountSetting } from './account-setting';
|
||||||
@@ -41,7 +41,7 @@ export const SettingModal = ({
|
|||||||
const modalContentRef = useRef<HTMLDivElement>(null);
|
const modalContentRef = useRef<HTMLDivElement>(null);
|
||||||
const modalContentWrapperRef = useRef<HTMLDivElement>(null);
|
const modalContentWrapperRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (!modalProps.open) return;
|
if (!modalProps.open) return;
|
||||||
let animationFrameId: number;
|
let animationFrameId: number;
|
||||||
const onResize = debounce(() => {
|
const onResize = debounce(() => {
|
||||||
|
|||||||
@@ -162,7 +162,9 @@ export const SettingSidebar = ({
|
|||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{runtimeConfig.enableCloud && loginStatus === 'authenticated' ? (
|
{runtimeConfig.enableCloud && loginStatus === 'authenticated' ? (
|
||||||
|
<Suspense>
|
||||||
<UserInfo onAccountSettingClick={onAccountSettingClick} />
|
<UserInfo onAccountSettingClick={onAccountSettingClick} />
|
||||||
|
</Suspense>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user