Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Add carbon #8242

Merged
merged 1 commit into from
Sep 17, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
70 changes: 70 additions & 0 deletions docs/src/app/components/Carbon.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#ad{margin:8px 0 0;min-height:116px}@media (min-width:600px){#ad{margin:0;min-height:0}}

#carbonads {
padding: 8px;
position: relative;
box-sizing: content-box;
border-radius: 4px;
background-color: #fafafa
}
@media (min-width: 600px) {
#carbonads {
float: right;
margin: 16px 8px 8px;
max-width: 130px
}
}
@media (min-width: 1920px) {
#carbonads {
right: 16px;
margin: 0;
bottom: 16px;
position: fixed
}
}
#carbonads img {
vertical-align: middle
}
#carbonads a {
text-decoration: none
}
#carbonads .carbon-wrap {
display: flex
}
#carbonads .carbon-text {
color: rgba(0, 0, 0, .87);
margin: 0 0 0 8px;
display: block;
font-size: 14px;
font-weight: 400;
font-family: Roboto, Helvetica, Arial, sans-serif;
line-height: 20px
}
#carbonads .carbon-poweredby {
color: rgba(0, 0, 0, .54);
right: 4px;
bottom: 4px;
display: block;
position: absolute;
font-size: 12px;
margin-top: 4px;
font-weight: 400;
font-family: Roboto, Helvetica, Arial, sans-serif;
line-height: 1
}
@media (min-width: 600px) {
#carbonads .carbon-poweredby {
position: static;
margin-top: 0
}
}
@media (min-width: 600px) {
#carbonads .carbon-text {
margin: 8px 0
}
}
@media (min-width: 600px) {
#carbonads .carbon-wrap {
display: block
}
}
27 changes: 27 additions & 0 deletions docs/src/app/components/Carbon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react';

require('./Carbon.css');

class Carbon extends React.Component {
componentDidMount() {
if (process.env.NODE_ENV !== 'production') {
return;
}

const script = document.createElement('script');
script.setAttribute('async', '');
script.src =
'//cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=materialuicom';
script.id = '_carbonads_js';
const ad = document.querySelector('#ad');
if (ad) {
ad.appendChild(script);
}
}

render() {
return <div id="ad" />;
}
}

export default Carbon;
2 changes: 2 additions & 0 deletions docs/src/app/components/Master.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import getMuiTheme from 'material-ui/styles/getMuiTheme';
import {darkWhite, lightWhite, grey900} from 'material-ui/styles/colors';
import AppNavDrawer from './AppNavDrawer';
import FullWidthSection from './FullWidthSection';
import Carbon from './Carbon';
import withWidth, {MEDIUM, LARGE} from 'material-ui/utils/withWidth';

class Master extends Component {
Expand Down Expand Up @@ -209,6 +210,7 @@ class Master extends Component {
{title !== '' ?
<div style={prepareStyles(styles.root)}>
<div style={prepareStyles(styles.content)}>
<Carbon key={location.pathname} />
{React.cloneElement(children, {
onChangeMuiTheme: this.handleChangeMuiTheme,
})}
Expand Down