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

Updates some random styles. #45

Merged
merged 1 commit into from
Aug 7, 2017
Merged
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
11 changes: 7 additions & 4 deletions src/renderer/features/example-using-tabs/dog-tab/dog-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ import { Text, CenteredContent, spacing, cssProps } from '../../../platform'
import { FunDog } from '../fun-dog'
import { Logo } from '../logo'

const TEXT_STYLE = cssProps({
paddingTop: spacing.medium,
paddingBottom: spacing.medium,
const TEXT_STYLE = cssProps({})

const DOG_STYLE = cssProps({
marginTop: spacing.medium,
marginBottom: spacing.medium,
})

export interface DogTabProps {
style?: CSSProperties | CSSProperties[] | null | false
}
Expand All @@ -17,7 +20,7 @@ export class DogTab extends React.PureComponent<DogTabProps, {}> {
return (
<CenteredContent style={this.props.style}>
<Text style={TEXT_STYLE}>Do a barrel roll.</Text>
<FunDog />
<FunDog style={DOG_STYLE} />
<Logo />
</CenteredContent>
)
Expand Down
20 changes: 15 additions & 5 deletions src/renderer/features/example-using-tabs/fun-dog/fun-dog.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
import * as React from 'react'
import { CSSProperties } from 'react'
import dogImage from './fun-dog.jpg'
import { cssProps, colors, SpinAnimation } from '../../../platform'
import { colors, SpinAnimation } from '../../../platform'
import { css } from 'glamor'

const ROOT = cssProps({
width: 300,
const IMAGE = css({
width: 400,
borderStyle: 'solid',
borderWidth: 2,
borderColor: colors.line,
borderRadius: 4,
transition: `all 150ms`,
'&:hover': {
borderColor: colors.sentiment.highlight,
},
})

export function FunDog() {
export interface FunDogProps {
style?: CSSProperties | CSSProperties[] | null | false
}

export function FunDog(props: FunDogProps) {
const style = css(IMAGE, props.style)
return (
<SpinAnimation>
<img draggable={false} src={dogImage} {...css(ROOT)} />
<img draggable={false} src={dogImage} {...style} />
</SpinAnimation>
)
}
23 changes: 16 additions & 7 deletions src/renderer/features/example-using-tabs/logo/logo.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
import * as React from 'react'
import { CSSProperties } from 'react'
import { cssProps, animations } from '../../../platform'
import icon from './electron-icon.svg'
import { css } from 'glamor'

const ROOT = cssProps({
width: 80,
height: 80,
animation: `${animations.spin360} infinite 5s linear`,
})
const ROOT = css(
cssProps({
width: 80,
height: 80,
animation: `${animations.spin360} infinite 5s linear`,
}),
)

export function Logo() {
return <img draggable={false} src={icon} {...css(ROOT)} />
export interface LogoProps {
style?: CSSProperties | CSSProperties[] | null | false
}

export function Logo(props: LogoProps) {
const style = css(ROOT, props.style)

return <img draggable={false} src={icon} {...style} />
}
11 changes: 9 additions & 2 deletions src/renderer/features/example-using-tabs/long-tab/long-tab.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import * as React from 'react'
import { CSSProperties } from 'react'
import { Text, ScrollableContent, spacing, cssProps } from '../../../platform'
import { css } from 'glamor'

const PADDED = cssProps({
paddingBottom: spacing.medium,
paddingBottom: spacing.large,
})

const ROOT = cssProps({
padding: spacing.large,
})

export interface LongTabProps {
Expand All @@ -12,8 +17,10 @@ export interface LongTabProps {

export class LongTab extends React.PureComponent<LongTabProps, {}> {
render() {
const root = css(ROOT, this.props.style)

return (
<ScrollableContent style={this.props.style}>
<ScrollableContent style={root}>
<Text style={PADDED}>
Lomo kombucha irony, keffiyeh man bun pitchfork helvetica organic godard brunch XOXO
subway tile. Vexillologist gluten-free prism air plant godard raw denim tacos forage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react'
import { CSSProperties } from 'react'
import { spacing, styles, cssProps } from '../..'
import { css, compose } from 'glamor'
import { compose } from 'glamor'

export interface ScrollableContentProps {
children?: React.ReactNode
Expand All @@ -11,12 +11,12 @@ export interface ScrollableContentProps {
const ROOT = compose(
styles.column,
styles.flex1,
cssProps({ padding: spacing.medium, overflowY: 'scroll' }),
cssProps({ padding: spacing.small, overflowY: 'scroll' }),
)

export function ScrollableContent(props: ScrollableContentProps) {
return (
<div {...css(ROOT, props.style)}>
<div {...compose(ROOT, props.style)}>
{props.children}
</div>
)
Expand Down
7 changes: 4 additions & 3 deletions src/renderer/platform/theme/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ const white = grayScale[grayScale.length - 1]
// =--- colors with specific meaning ------>

const sentiment = {
error: '#D44',
success: '#4D4',
warning: '#DD4',
error: 'cherry',
success: 'lime',
warning: 'orange',
highlight: secondaryScale[2],
}

// =--- special-use window chrome ------>
Expand Down