Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Windows 10 style window titlebar #508

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class Settings extends React.Component {
top: 44px;
left: 0;
border: 1px solid ${COLORS.SECONDARY};
width: 184px;
width: 242px;
border-radius: 3px;
background: ${COLORS.BLACK};
}
Expand Down
4 changes: 2 additions & 2 deletions components/ThemeSelect.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import { None, BW, Sharp } from './svg/WindowThemes'
import { None, BW, Sharp, Win } from './svg/WindowThemes'
import { COLORS } from '../lib/constants'

const WINDOW_THEMES_MAP = { none: None, sharp: Sharp, bw: BW }
const WINDOW_THEMES_MAP = { none: None, sharp: Sharp, bw: BW, win: Win }
export const WINDOW_THEMES = Object.keys(WINDOW_THEMES_MAP)

class ThemeSelect extends React.Component {
Expand Down
4 changes: 2 additions & 2 deletions components/WindowControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'

import CopyButton from './CopyButton'
import { COLORS } from '../lib/constants'
import { Controls, ControlsBW } from './svg/Controls'
import { Controls, ControlsBW, ControlsWin } from './svg/Controls'
import CopySVG from './svg/Copy'
import CheckMark from './svg/Checkmark'

Expand Down Expand Up @@ -36,7 +36,7 @@ function renderCopyButton({ copied }) {

export default ({ titleBar, theme, handleTitleBarChange, copyable, code }) => (
<div className="window-controls">
{theme === 'bw' ? <ControlsBW /> : <Controls />}
{theme === 'bw' ? <ControlsBW /> : theme === 'win' ? <ControlsWin /> : <Controls />}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace this with f.e an object:

const controls = {
  bw: <ControlsBW />,
  win: <ControlsWin />
}

{ controls[theme] || <Controls /> }

<div className="window-title-container">
<input
aria-label="Image Title"
Expand Down
11 changes: 11 additions & 0 deletions components/svg/Controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,14 @@ export const ControlsBW = () => (
</g>
</svg>
)

export const ControlsWin = () => (
<svg xmlns="http://www.w3.org/2000/svg" width="120" height="30" viewBox="0 0 120 30">
<g fill="none" fillRule="evenodd" transform="translate(1 1)">
<line x1="0.5" y1="15.5" x2="9.5" y2="15.5" stroke="#ffffff" strokeWidth="1" />
<rect x="45.5" y="10.5" width="9" height="9" stroke="#ffffff" strokeWidth="1" />
<line x1="91.5" y1="10.5" x2="100.5" y2="19.5" stroke="#ffffff" strokeWidth="1" />
<line x1="91.5" y1="19.5" x2="100.5" y2="10.5" stroke="#ffffff" strokeWidth="1" />
</g>
</svg>
)
32 changes: 32 additions & 0 deletions components/svg/WindowThemes.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,35 @@ export const None = () => (
</g>
</svg>
)

export const Win = () => (
<svg
xmlns="http://www.w3.org/2000/svg"
width="50"
height="50"
viewBox="0 0 81 81"
xmlnsXlink="http://www.w3.org/1999/xlink"
>
<defs>
<rect id="a1" width="81" height="81" rx="3" />
</defs>
<g fill="none" fillRule="evenodd">
<mask id="b1" fill="white">
<use xlinkHref="#a1" />
</mask>
<use fill="#616161" xlinkHref="#a1" />
<g transform="translate(0 32)" mask="url(#b1)">
<path
fill="#000000"
fillRule="nonzero"
d="M66.0458013,46.1092762 C66.0458013,48.3193105 64.2622787,50.1077029 62.050805,50.1077029 L0.174089069,50.1077029 L0.174089069,6.16868499 C0.174089069,0.174657534 0.174089069,0.174657534 0.174089069,0.174657534 L66.0458013,0.174657534 L66.0458013,46.1092762 Z"
/>
<g transform="translate(5 12.5)">
<rect x="0" y="0" width="8" height="8" stroke="#ffffff" strokeWidth="1" />
<line x1="37" y1="0" x2="45" y2="8" stroke="#ffffff" strokeWidth="1" />
<line x1="37" y1="8" x2="45" y2="0" stroke="#ffffff" strokeWidth="1" />
</g>
</g>
</g>
</svg>
)