Skip to content
This repository was archived by the owner on Jun 5, 2019. It is now read-only.

Commit 32072e3

Browse files
authored
Merge pull request #39 from skellock/style-touchups
Style touchups
2 parents 22efc1d + 43c3705 commit 32072e3

File tree

15 files changed

+95
-59
lines changed

15 files changed

+95
-59
lines changed

src/renderer/features/example-using-tabs/dog-tab/dog-tab.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as React from 'react'
2+
import { CSSProperties } from 'react'
23
import { Text, CenteredContent, spacing, cssProps } from '../../../platform'
34
import { FunDog } from '../fun-dog'
45
import { Logo } from '../logo'
@@ -7,11 +8,14 @@ const TEXT_STYLE = cssProps({
78
paddingTop: spacing.medium,
89
paddingBottom: spacing.medium,
910
})
11+
export interface DogTabProps {
12+
style?: CSSProperties | CSSProperties[] | null | false
13+
}
1014

11-
export class DogTab extends React.PureComponent<{}, {}> {
15+
export class DogTab extends React.PureComponent<DogTabProps, {}> {
1216
render() {
1317
return (
14-
<CenteredContent>
18+
<CenteredContent style={this.props.style}>
1519
<FunDog />
1620
<Text style={TEXT_STYLE}>Wake up and smell the electrons.</Text>
1721
<Logo />

src/renderer/features/example-using-tabs/fun-dog/fun-dog.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import * as React from 'react'
22
import dogImage from './fun-dog.jpg'
3-
import { cssProps } from '../../../platform'
3+
import { cssProps, colors } from '../../../platform'
44
import { css } from 'glamor'
55

66
const ROOT = cssProps({
77
width: 300,
88
borderStyle: 'solid',
9-
borderWidth: 1,
9+
borderWidth: 2,
10+
borderColor: colors.line,
11+
borderRadius: 4,
1012
})
1113

1214
export function FunDog() {

src/renderer/features/example-using-tabs/header/header.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ const ROOT = compose(
99
cssProps({
1010
textAlign: 'center',
1111
paddingTop: spacing.verySmall,
12-
backgroundColor: colors.headerBg,
13-
fontSize: fontSizes.small,
12+
backgroundColor: colors.navBackground,
13+
color: colors.navLine,
14+
fontSize: fontSizes.medium,
1415
}),
1516
)
1617

src/renderer/features/example-using-tabs/long-tab/long-tab.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
import * as React from 'react'
2+
import { CSSProperties } from 'react'
23
import { Text, ScrollableContent, spacing, cssProps } from '../../../platform'
3-
import { css } from 'glamor'
44

55
const PADDED = cssProps({
66
paddingBottom: spacing.medium,
77
})
88

9-
export class LongTab extends React.PureComponent<{}, {}> {
9+
export interface LongTabProps {
10+
style?: CSSProperties | CSSProperties[] | null | false
11+
}
12+
13+
export class LongTab extends React.PureComponent<LongTabProps, {}> {
1014
render() {
1115
return (
12-
<ScrollableContent>
13-
<Text {...css(PADDED)}>
16+
<ScrollableContent style={this.props.style}>
17+
<Text style={PADDED}>
1418
Lomo kombucha irony, keffiyeh man bun pitchfork helvetica organic godard brunch XOXO
1519
subway tile. Vexillologist gluten-free prism air plant godard raw denim tacos forage
1620
neutra kogi lyft beard. Direct trade retro ramps, pour-over slow-carb 8-bit hell of
@@ -22,7 +26,7 @@ export class LongTab extends React.PureComponent<{}, {}> {
2226
bicycle rights. Post-ironic selfies gochujang franzen master cleanse chicharrones ethical
2327
coloring book keytar 8-bit poutine fixie.
2428
</Text>
25-
<Text {...css(PADDED)}>
29+
<Text style={PADDED}>
2630
Shaman glossier listicle, tousled knausgaard vegan microdosing mumblecore meditation
2731
freegan taiyaki. Dreamcatcher occupy enamel pin edison bulb PBR&B +1 food truck try-hard
2832
forage pug iceland sartorial scenester. Yr brooklyn pinterest +1 sustainable. Narwhal
@@ -33,7 +37,7 @@ export class LongTab extends React.PureComponent<{}, {}> {
3337
VHS, brooklyn salvia lyft activated charcoal direct trade mlkshk unicorn williamsburg
3438
post-ironic banjo. Sriracha cray coloring book activated charcoal irony meditation.
3539
</Text>
36-
<Text {...css(PADDED)}>
40+
<Text style={PADDED}>
3741
Drinking vinegar 8-bit roof party leggings, master cleanse deep v slow-carb locavore
3842
hoodie. La croix thundercats trust fund synth, truffaut woke bitters twee craft beer next
3943
level mustache ramps yr hashtag. Portland 8-bit gentrify 3 wolf moon hexagon, 90's
@@ -49,7 +53,7 @@ export class LongTab extends React.PureComponent<{}, {}> {
4953
Listicle letterpress waistcoat actually, hell of typewriter normcore thundercats kale
5054
chips post-ironic helvetica pabst.
5155
</Text>
52-
<Text {...css(PADDED)}>
56+
<Text style={PADDED}>
5357
Chambray ethical vice williamsburg. Four loko chambray glossier seitan, stumptown fanny
5458
pack PBR&B normcore quinoa echo park. Direct trade taxidermy pok pok, unicorn you probably
5559
haven't heard of them letterpress leggings. Flannel kinfolk four loko taxidermy fanny pack
@@ -63,7 +67,7 @@ export class LongTab extends React.PureComponent<{}, {}> {
6367
master cleanse wayfarers. Mlkshk sriracha microdosing, chia post-ironic paleo chillwave
6468
PBR&B.
6569
</Text>
66-
<Text {...css(PADDED)}>
70+
<Text style={PADDED}>
6771
Ugh +1 narwhal, truffaut polaroid live-edge artisan tousled wayfarers taxidermy chia raw
6872
denim flannel. Vinyl polaroid franzen portland tilde edison bulb, you probably haven't
6973
heard of them hot chicken mlkshk. Prism blue bottle mustache, tattooed selvage franzen
@@ -76,7 +80,7 @@ export class LongTab extends React.PureComponent<{}, {}> {
7680
synth affogato pickled. Truffaut typewriter quinoa copper mug fanny pack glossier 8-bit,
7781
meditation vape jean shorts. Ennui church-key cliche af intelligentsia, fam fingerstache.
7882
</Text>
79-
<Text {...css(PADDED)}>Oh. You need a little dummy text for your mockup? How quaint.</Text>
83+
<Text style={PADDED}>Oh. You need a little dummy text for your mockup? How quaint.</Text>
8084
<Text>I bet you’re still using Bootstrap too…</Text>
8185
</ScrollableContent>
8286
)

src/renderer/features/example-using-tabs/welcome-screen/sample-tabs.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,19 @@ const KEY_1 = `${commandOrControlKey}+1`
2222
const KEY_2 = `${commandOrControlKey}+2`
2323
const KEY_3 = `${commandOrControlKey}+3`
2424

25-
const ROOT_STYLE = compose(
25+
const ROOT = compose(
26+
styles.windowDrag,
2627
styles.row,
2728
cssProps({
2829
paddingLeft: spacing.medium,
2930
paddingRight: spacing.medium,
30-
backgroundColor: colors.headerBg,
31+
paddingTop: spacing.small,
32+
backgroundColor: colors.navBackground,
33+
justifyContent: 'center',
34+
borderBottom: 1,
35+
borderBottomColor: colors.line,
36+
borderBottomStyle: 'solid',
37+
boxShadow: `0px 2px 10px ${colors.navBackground}`,
3138
}),
3239
)
3340

@@ -51,10 +58,10 @@ export class SampleTabs extends React.PureComponent<SampleTabsProps, {}> {
5158
render() {
5259
const { tab } = this.props
5360
return (
54-
<div {...css(ROOT_STYLE)}>
55-
<Tab onClick={this.changeTab1} active={tab === 'one'} text='Random Dog' />
56-
<Tab onClick={this.changeTab2} active={tab === 'two'} text='Long Content' />
57-
<Tab onClick={this.changeTab3} active={tab === 'three'} text='Empty' />
61+
<div {...css(ROOT)}>
62+
<Tab onClick={this.changeTab1} active={tab === 'one'} text='doggo' />
63+
<Tab onClick={this.changeTab2} active={tab === 'two'} text='paragraphs' />
64+
<Tab onClick={this.changeTab3} active={tab === 'three'} text='empty' />
5865
</div>
5966
)
6067
}

src/renderer/features/example-using-tabs/welcome-screen/welcome-screen.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ import * as React from 'react'
22
import { SampleTabs, SampleTabType } from './sample-tabs'
33
import { LongTab } from '../long-tab'
44
import { DogTab } from '../dog-tab'
5-
import { Header } from '../header'
6-
import { styles } from '../../../platform'
5+
import { styles, cssProps } from '../../../platform'
76
import Store = require('electron-store')
87
import { css } from 'glamor'
98

9+
const HIDDEN = cssProps({
10+
display: 'none',
11+
})
12+
1013
// a sample store
1114
const store = new Store()
1215

@@ -36,10 +39,9 @@ export class WelcomeScreen extends React.Component<{}, WelcomeScreenState> {
3639
render() {
3740
return (
3841
<div id='WelcomeScreen' {...css(styles.column, styles.flex1)}>
39-
<Header />
4042
<SampleTabs tab={this.state.tab} onChangeTab={this.setTab} />
41-
{this.state.tab === 'one' && <DogTab />}
42-
{this.state.tab === 'two' && <LongTab />}
43+
<DogTab style={this.state.tab !== 'one' && HIDDEN} />
44+
<LongTab style={this.state.tab !== 'two' && HIDDEN} />
4345
</div>
4446
)
4547
}

src/renderer/platform/components/centered-content/centered-content.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { compose, css } from 'glamor'
55

66
export interface CenteredContentProps {
77
children: React.ReactNode
8-
style?: CSSProperties | CSSProperties[]
8+
style?: CSSProperties | CSSProperties[] | false | null
99
}
1010

1111
const BASE = compose(

src/renderer/platform/components/scrollable-content/scrollable-content.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { css, compose } from 'glamor'
55

66
export interface ScrollableContentProps {
77
children?: React.ReactNode
8-
style?: CSSProperties | CSSProperties[]
8+
style?: CSSProperties | CSSProperties[] | null | false
99
}
1010

1111
const ROOT = compose(

src/renderer/platform/components/tab/tab.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,33 @@ const BASE = compose(
1414
styles.noWindowDrag,
1515
cssProps({
1616
cursor: 'pointer',
17-
padding: spacing.small,
18-
fontSize: fontSizes.default,
17+
paddingTop: spacing.small,
18+
paddingBottom: spacing.small,
19+
paddingLeft: spacing.medium,
20+
paddingRight: spacing.medium,
1921
}),
2022
)
2123

2224
const ACTIVE = cssProps({
23-
color: colors.primary,
24-
borderBottom: colors.primary,
25+
borderBottom: colors.line,
2526
borderBottomWidth: 2,
2627
borderBottomStyle: 'solid',
2728
})
2829

30+
const BASE_TEXT = cssProps({ color: colors.navInactive, fontSize: fontSizes.mediumPlus })
31+
const ACTIVE_TEXT = cssProps({ color: colors.navActive })
32+
2933
/**
3034
* A tab component that you click on. Not the tab panel.
3135
*/
3236
export function Tab(props: TabProps) {
3337
// work out the styles
3438
const styleProps = css(BASE, props.active && ACTIVE, props.style)
39+
const textStyle = css(BASE_TEXT, props.active && ACTIVE_TEXT)
3540

3641
return (
3742
<div {...styleProps} onClick={props.onClick}>
38-
<Text text={props.text} />
43+
<Text style={textStyle} text={props.text} />
3944
</div>
4045
)
4146
}

src/renderer/platform/components/text/text.test.js.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ Generated by [AVA](https://ava.li).
99
> Snapshot 1
1010
1111
<p
12-
"data-css-6etoft"=""
12+
"data-css-f6nk39"=""
1313
/>
1414

1515
## children have priority over text
1616

1717
> Snapshot 1
1818
1919
<p
20-
"data-css-6etoft"=""
20+
"data-css-f6nk39"=""
2121
>
2222
one
2323
</p>
@@ -27,7 +27,7 @@ Generated by [AVA](https://ava.li).
2727
> Snapshot 1
2828
2929
<p
30-
"data-css-6etoft"=""
30+
"data-css-f6nk39"=""
3131
>
3232
hi
3333
</p>
@@ -37,7 +37,7 @@ Generated by [AVA](https://ava.li).
3737
> Snapshot 1
3838
3939
<p
40-
"data-css-6etoft"=""
40+
"data-css-f6nk39"=""
4141
>
4242
hello
4343
</p>
@@ -47,7 +47,7 @@ Generated by [AVA](https://ava.li).
4747
> Snapshot 1
4848
4949
<p
50-
"data-css-1sxkrsg"=""
50+
"data-css-19csgvw"=""
5151
>
5252
one
5353
</p>

0 commit comments

Comments
 (0)