Skip to content

Instantly share code, notes, and snippets.

@ianstormtaylor
Last active October 26, 2016 17:29
Show Gist options
  • Save ianstormtaylor/c8b68e7ac46f94df53ef652ff30f8003 to your computer and use it in GitHub Desktop.
Save ianstormtaylor/c8b68e7ac46f94df53ef652ff30f8003 to your computer and use it in GitHub Desktop.
import React from 'react'
import css from 'glamor'
import { UI } from '../constants'
const styles = {
wrapper: css`
display: table;
width: 650px;
`,
image: css`
display: table-cell;
vertical-align: middle;
width: 150px;
padding-right: 25px;
border: 1px solid ${UI.gray}
`,
body: css`
font-size: 16px;
line-height: 1.5;
color: ${UI.red}
`
}
class MyComponent extends React.Component {
render() {
return (
<div className={styles.wrapper}>
<img className={styles.image} src={this.props.imageUrl} />
<div className={styles.body}>{this.props.text}</div>
</div>
)
}
}
import React from 'react'
import styled from 'styled-components'
import { UI } from '../constants'
const Wrapper = styled.div`
display: table;
width: 650px;
`
const Image = styled.h1`
display: table-cell;
vertical-align: middle;
width: 150px;
padding-right: 25px;
border: 1px solid ${UI.gray}
`
const Body = styled.div`
font-size: 16px;
line-height: 1.5;
color: ${UI.red}
`
class MyComponent extends React.Component {
render() {
return (
<Wrapper>
<Image src={this.props.imageUrl} />
<Body>{this.props.text}</Body>
</Wrapper>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment