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

Commit 9f4fd86

Browse files
authored
Merge pull request #45 from skellock/random-styles
Updates some random styles.
2 parents cd9e78e + 58f5e71 commit 9f4fd86

File tree

6 files changed

+54
-24
lines changed

6 files changed

+54
-24
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ import { Text, CenteredContent, spacing, cssProps } from '../../../platform'
44
import { FunDog } from '../fun-dog'
55
import { Logo } from '../logo'
66

7-
const TEXT_STYLE = cssProps({
8-
paddingTop: spacing.medium,
9-
paddingBottom: spacing.medium,
7+
const TEXT_STYLE = cssProps({})
8+
9+
const DOG_STYLE = cssProps({
10+
marginTop: spacing.medium,
11+
marginBottom: spacing.medium,
1012
})
13+
1114
export interface DogTabProps {
1215
style?: CSSProperties | CSSProperties[] | null | false
1316
}
@@ -17,7 +20,7 @@ export class DogTab extends React.PureComponent<DogTabProps, {}> {
1720
return (
1821
<CenteredContent style={this.props.style}>
1922
<Text style={TEXT_STYLE}>Do a barrel roll.</Text>
20-
<FunDog />
23+
<FunDog style={DOG_STYLE} />
2124
<Logo />
2225
</CenteredContent>
2326
)
Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
11
import * as React from 'react'
2+
import { CSSProperties } from 'react'
23
import dogImage from './fun-dog.jpg'
3-
import { cssProps, colors, SpinAnimation } from '../../../platform'
4+
import { colors, SpinAnimation } from '../../../platform'
45
import { css } from 'glamor'
56

6-
const ROOT = cssProps({
7-
width: 300,
7+
const IMAGE = css({
8+
width: 400,
89
borderStyle: 'solid',
910
borderWidth: 2,
1011
borderColor: colors.line,
1112
borderRadius: 4,
13+
transition: `all 150ms`,
14+
'&:hover': {
15+
borderColor: colors.sentiment.highlight,
16+
},
1217
})
1318

14-
export function FunDog() {
19+
export interface FunDogProps {
20+
style?: CSSProperties | CSSProperties[] | null | false
21+
}
22+
23+
export function FunDog(props: FunDogProps) {
24+
const style = css(IMAGE, props.style)
1525
return (
1626
<SpinAnimation>
17-
<img draggable={false} src={dogImage} {...css(ROOT)} />
27+
<img draggable={false} src={dogImage} {...style} />
1828
</SpinAnimation>
1929
)
2030
}
Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
import * as React from 'react'
2+
import { CSSProperties } from 'react'
23
import { cssProps, animations } from '../../../platform'
34
import icon from './electron-icon.svg'
45
import { css } from 'glamor'
56

6-
const ROOT = cssProps({
7-
width: 80,
8-
height: 80,
9-
animation: `${animations.spin360} infinite 5s linear`,
10-
})
7+
const ROOT = css(
8+
cssProps({
9+
width: 80,
10+
height: 80,
11+
animation: `${animations.spin360} infinite 5s linear`,
12+
}),
13+
)
1114

12-
export function Logo() {
13-
return <img draggable={false} src={icon} {...css(ROOT)} />
15+
export interface LogoProps {
16+
style?: CSSProperties | CSSProperties[] | null | false
17+
}
18+
19+
export function Logo(props: LogoProps) {
20+
const style = css(ROOT, props.style)
21+
22+
return <img draggable={false} src={icon} {...style} />
1423
}

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import * as React from 'react'
22
import { CSSProperties } from 'react'
33
import { Text, ScrollableContent, spacing, cssProps } from '../../../platform'
4+
import { css } from 'glamor'
45

56
const PADDED = cssProps({
6-
paddingBottom: spacing.medium,
7+
paddingBottom: spacing.large,
8+
})
9+
10+
const ROOT = cssProps({
11+
padding: spacing.large,
712
})
813

914
export interface LongTabProps {
@@ -12,8 +17,10 @@ export interface LongTabProps {
1217

1318
export class LongTab extends React.PureComponent<LongTabProps, {}> {
1419
render() {
20+
const root = css(ROOT, this.props.style)
21+
1522
return (
16-
<ScrollableContent style={this.props.style}>
23+
<ScrollableContent style={root}>
1724
<Text style={PADDED}>
1825
Lomo kombucha irony, keffiyeh man bun pitchfork helvetica organic godard brunch XOXO
1926
subway tile. Vexillologist gluten-free prism air plant godard raw denim tacos forage

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react'
22
import { CSSProperties } from 'react'
33
import { spacing, styles, cssProps } from '../..'
4-
import { css, compose } from 'glamor'
4+
import { compose } from 'glamor'
55

66
export interface ScrollableContentProps {
77
children?: React.ReactNode
@@ -11,12 +11,12 @@ export interface ScrollableContentProps {
1111
const ROOT = compose(
1212
styles.column,
1313
styles.flex1,
14-
cssProps({ padding: spacing.medium, overflowY: 'scroll' }),
14+
cssProps({ padding: spacing.small, overflowY: 'scroll' }),
1515
)
1616

1717
export function ScrollableContent(props: ScrollableContentProps) {
1818
return (
19-
<div {...css(ROOT, props.style)}>
19+
<div {...compose(ROOT, props.style)}>
2020
{props.children}
2121
</div>
2222
)

src/renderer/platform/theme/colors.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ const white = grayScale[grayScale.length - 1]
2929
// =--- colors with specific meaning ------>
3030

3131
const sentiment = {
32-
error: '#D44',
33-
success: '#4D4',
34-
warning: '#DD4',
32+
error: 'cherry',
33+
success: 'lime',
34+
warning: 'orange',
35+
highlight: secondaryScale[2],
3536
}
3637

3738
// =--- special-use window chrome ------>

0 commit comments

Comments
 (0)