Skip to content

Commit

Permalink
chore: handle windows classicial scrollbar, close #120
Browse files Browse the repository at this point in the history
  • Loading branch information
magicdawn committed Oct 7, 2024
1 parent 75c3eab commit e2c6229
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/RecHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { $headerHeight, $usingEvolevdHeader } from '$header'
import { useIsDarkMode } from '$modules/dark-mode'
import { ConfigIcon } from '$modules/icon'
import { useSettingsSnapshot } from '$modules/settings'
import { isMac } from '$ua'
import { getElementOffset, shouldDisableShortcut } from '$utility/dom'
import { Button, Space } from 'antd'
import { size } from 'polished'
Expand Down Expand Up @@ -235,9 +236,11 @@ function useExpandToFullWidthCss() {

return useMemo(() => {
if (!xScrolling) {
// https://github.com/magicdawn/bilibili-app-recommend/issues/120
const scrollbarWidth = isMac ? '0px' : '20px'
return css`
margin-inline: calc((100% - 100vw) / 2);
padding-inline: calc((100vw - 100%) / 2);
margin-inline: calc((100% - 100vw + ${scrollbarWidth}) / 2);
padding-inline: calc((100vw - ${scrollbarWidth} - 100%) / 2);
`
} else {
const w = Math.floor(bodyWidth!)
Expand Down

0 comments on commit e2c6229

Please sign in to comment.