fix: prettier fullscreen for macOS

fixes #5
This commit is contained in:
Zachary Riedlshah 2019-05-09 13:43:50 +12:00 committed by Benjamin Staneck
parent 84bab83e88
commit 970a98f60b
9 changed files with 66 additions and 7 deletions

View file

@ -92,7 +92,8 @@ export default class Header extends React.PureComponent {
tabs: this.props.tabs,
borderColor: this.props.borderColor,
onClose: this.props.onCloseTab,
onChange: this.onChangeIntent
onChange: this.onChangeIntent,
fullScreen: this.props.fullScreen
});
const {borderColor} = props;
let title = 'Hyper';

View file

@ -9,7 +9,7 @@ const isMac = /Mac/.test(navigator.userAgent);
export default class Tabs extends React.PureComponent {
render() {
const {tabs = [], borderColor, onChange, onClose} = this.props;
const {tabs = [], borderColor, onChange, onClose, fullScreen} = this.props;
const hide = !isMac && tabs.length === 1;
@ -19,7 +19,7 @@ export default class Tabs extends React.PureComponent {
{tabs.length === 1 && isMac ? <div className="tabs_title">{tabs[0].title}</div> : null}
{tabs.length > 1
? [
<ul key="list" className="tabs_list">
<ul key="list" className={`tabs_list ${fullScreen && isMac ? 'tabs_fullScreen' : ''}`}>
{tabs.map((tab, i) => {
const {uid, title, isActive, hasActivity} = tab;
const props = getTabProps(tab, this.props, {
@ -35,7 +35,13 @@ export default class Tabs extends React.PureComponent {
return <Tab key={`tab-${uid}`} {...props} />;
})}
</ul>,
isMac && <div key="shim" style={{borderColor}} className="tabs_borderShim" />
isMac && (
<div
key="shim"
style={{borderColor}}
className={`tabs_borderShim ${fullScreen ? 'tabs_borderShimUndo' : ''}`}
/>
)
]
: null}
{this.props.customChildren}
@ -75,6 +81,10 @@ export default class Tabs extends React.PureComponent {
margin-left: ${isMac ? '76px' : '0'};
}
.tabs_fullScreen {
margin-left: -1px;
}
.tabs_borderShim {
position: absolute;
width: 76px;
@ -83,6 +93,10 @@ export default class Tabs extends React.PureComponent {
border-bottom-style: solid;
border-bottom-width: 1px;
}
.tabs_borderShimUndo {
border-bottom-width: 0px;
}
`}</style>
</nav>
);