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

Refactored css into js for core and mixin less files, as well as added contrast ratio detection. #482

Merged
merged 7 commits into from
Mar 30, 2015
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
5 changes: 2 additions & 3 deletions docs/src/app/components/master.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ class Master extends React.Component {
className="mui-dark-theme"
onMenuIconButtonTouchTap={this._onMenuIconButtonTouchTap}
title={title}
zDepth={0}>
{githubButton}
</AppBar>
zDepth={0}
iconClassNameRight="muidocs-icon-custom-github"/>

<AppLeftNav ref="leftNav" />

Expand Down
2 changes: 1 addition & 1 deletion docs/src/app/components/pages/components/dialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class DialogPage extends React.Component {
ref="standardDialog"
title="Dialog With Standard Actions"
actions={standardActions}>
The actions in this window are created from the json that's passed in.
The actions in this window are created from the json that&#39;s passed in.
</Dialog>

<Dialog
Expand Down
37 changes: 27 additions & 10 deletions docs/src/app/components/pages/css-framework/colors.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
var React = require('react');
var mui = require('mui');
var Colors = mui.Styles.Colors;
var ColorManipulator = mui.Utils.ColorManipulator;

var ColorsPage = React.createClass({

Expand All @@ -19,10 +22,17 @@ var ColorsPage = React.createClass({
neutralGroups.push(this._getColorGroup(color, false));
}, this);

var googleLink = "https://www.google.com/design/spec/style/color.html#color-ui-color-palette";
var githubLink = "https://github.com/callemall/material-ui/blob/css-in-js/src/js/styles/colors.js";

return (
<div>
<h2 className="mui-font-style-headline">UI Color Palette</h2>
<p>We've created <a href="http://lesscss.org/">&#123;less&#125;</a> variables for every color used in the <a href="https://www.google.com/design/spec/style/color.html#color-ui-color-palette">UI Color Palette</a>.</p>
<p>
We&#39;ve created javascript variables for every color used in
the <a href={googleLink}>UI Color Palette</a>. They are stored
in <a href={githubLink}>styles/colors.js</a>.
</p>

<div className="color-palette">
{colorGroups}
Expand All @@ -36,10 +46,10 @@ var ColorsPage = React.createClass({
},

_getColorGroup: function(color, showAltPalette) {
var mainPalette = [50,100,200,300,400,500,600,700,800,900],
altPalette = ['A100','A200','A400','A700'],
cssColor = color.toLowerCase().replace(' ', '-'),
colors = [];
var mainPalette = [50,100,200,300,400,500,600,700,800,900];
var altPalette = ['A100','A200','A400','A700'];
var cssColor = color.replace(' ', '').replace(color.charAt(0), color.charAt(0).toLowerCase());
var colors = [];

mainPalette.forEach(function(mainValue) {
colors.push(this._getColorBlock(cssColor, mainValue));
Expand All @@ -60,15 +70,22 @@ var ColorsPage = React.createClass({
},

_getColorBlock: function(colorName, colorValue, colorTitle) {
var colorClass = colorName + '-' + colorValue,
classes = 'color ' + colorClass,
colorText = '@' + colorClass,
blockTitle;
var bgColorText = colorName + colorValue;
var bgColor = Colors[bgColorText];
var fgColor = Colors.fullBlack;
var contrastRatio = ColorManipulator.contrastRatio(bgColor, fgColor);
var blockTitle;

if (contrastRatio < 7) fgColor = Colors.fullWhite;
if (colorTitle) blockTitle = <span className="name">{colorTitle}</span>;

var styles = {
backgroundColor: bgColor,
color: fgColor,
};

return (
<li className={classes}>{blockTitle}{colorText}</li>
<li style={styles} className="color">{blockTitle}{bgColorText}</li>
);
}

Expand Down
2 changes: 1 addition & 1 deletion docs/src/app/components/pages/get-started.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class GetStarted extends React.Component {
'injectTapEventPlugin();\n';

return (
<div className="get-started-page mui-app-content-canvas">
<div className="get-started-page app-content-canvas">
<div className="full-width-section">

<h2 className="mui-font-style-headline">Prerequisites</h2>
Expand Down
4 changes: 1 addition & 3 deletions docs/src/app/components/pages/home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,17 @@ class HomePage extends React.Component {
},
githubStyle: {
margin: '16px 32px 0px 8px',
minWidth: 0,
},
demoStyle: {
margin: '16px 32px 0px 32px',
minWidth: 0,
},
}
}

render() {

return (
<div className="mui-app-content-canvas">
<div className="app-content-canvas">
<div className="home-page-hero full-width-section">
<div className="home-page-hero-content">
<img className="svg-logo" src="images/material-ui-logo.svg" />
Expand Down
2 changes: 1 addition & 1 deletion docs/src/app/components/pages/page-with-nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PageWithNav extends React.Component {

render() {
return (
<div className="mui-app-content-canvas page-with-nav">
<div className="app-content-canvas page-with-nav">
<div className="page-with-nav-content">
<RouteHandler />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// `:before` to contain the top-margins of child elements.
//
// Source: http://nicolasgallagher.com/micro-clearfix-hack/

.clearfix() {
&:before,
&:after {
Expand Down
Loading