Skip to content

Instantly share code, notes, and snippets.

@martinwheeler
Last active February 22, 2018 22:24
Show Gist options
  • Save martinwheeler/3d9c238c0e1db0567055d7aee94b0875 to your computer and use it in GitHub Desktop.
Save martinwheeler/3d9c238c0e1db0567055d7aee94b0875 to your computer and use it in GitHub Desktop.
import React, { PureComponent } from "react";
import { render } from "react-dom";
import { css } from "glamor";
const flex = {
display: "flex"
};
const column = {
flexDirection: "column"
};
const justify = where => ({
justifyContent: where
});
const padding = px => ({
padding: px
});
const mt = px => ({
marginTop: px
});
const mb = px => ({
marginBottom: px
});
const container = css({
...flex,
...column,
...padding("50px"),
...justify("center"),
...mt("10px"),
...mb("25px")
});
class MyComponent extends PureComponent {
render() {
return (
<div {...css(container)}>
<div>I'm a super flexible div</div>
<div>using glamor.</div>
</div>
);
}
}
render(<MyComponent />, document.getElementById("root"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment