mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-25 02:08:28 +02:00
Account for zoom for macOS stoplight padding
This commit is contained in:
@@ -2,6 +2,7 @@ import classNames from 'classnames';
|
|||||||
import type { HTMLAttributes, ReactNode } from 'react';
|
import type { HTMLAttributes, ReactNode } from 'react';
|
||||||
import { useIsFullscreen } from '../hooks/useIsFullscreen';
|
import { useIsFullscreen } from '../hooks/useIsFullscreen';
|
||||||
import { useOsInfo } from '../hooks/useOsInfo';
|
import { useOsInfo } from '../hooks/useOsInfo';
|
||||||
|
import { useSettings } from '../hooks/useSettings';
|
||||||
|
|
||||||
interface HeaderSizeProps extends HTMLAttributes<HTMLDivElement> {
|
interface HeaderSizeProps extends HTMLAttributes<HTMLDivElement> {
|
||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
@@ -16,17 +17,22 @@ export function HeaderSize({
|
|||||||
ignoreStoplights,
|
ignoreStoplights,
|
||||||
...props
|
...props
|
||||||
}: HeaderSizeProps) {
|
}: HeaderSizeProps) {
|
||||||
|
const settings = useSettings();
|
||||||
const platform = useOsInfo();
|
const platform = useOsInfo();
|
||||||
const fullscreen = useIsFullscreen();
|
const fullscreen = useIsFullscreen();
|
||||||
const stoplightsVisible = platform?.osType === 'macos' && !fullscreen && !ignoreStoplights;
|
const stoplightsVisible = platform?.osType === 'macos' && !fullscreen && !ignoreStoplights;
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-tauri-drag-region
|
data-tauri-drag-region
|
||||||
style={style}
|
style={{
|
||||||
|
...style,
|
||||||
|
// Add padding for macOS stoplights, but keep it the same width (account for the interface scale)
|
||||||
|
paddingLeft: stoplightsVisible ? 72 / settings.interfaceScale : undefined,
|
||||||
|
}}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
className,
|
className,
|
||||||
'pt-[1px] w-full border-b border-border-subtle min-w-0',
|
'pt-[1px] w-full border-b border-border-subtle min-w-0',
|
||||||
stoplightsVisible ? 'pl-20 pr-1' : 'pl-1',
|
stoplightsVisible ? 'pr-1' : 'pl-1',
|
||||||
size === 'md' && 'h-[27px]',
|
size === 'md' && 'h-[27px]',
|
||||||
size === 'lg' && 'h-[38px]',
|
size === 'lg' && 'h-[38px]',
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user