SASS examples ready
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
[ignore]
|
[ignore]
|
||||||
|
.*/node_modules/.*
|
||||||
|
|
||||||
[include]
|
[include]
|
||||||
|
|
||||||
@@ -11,5 +12,6 @@ unsafe-getters-setters=off
|
|||||||
|
|
||||||
[options]
|
[options]
|
||||||
include_warnings=true
|
include_warnings=true
|
||||||
|
module.file_ext=.scss
|
||||||
|
|
||||||
[strict]
|
[strict]
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
const rewireEslint = require("react-app-rewire-eslint");
|
const rewireEslint = require("react-app-rewire-eslint");
|
||||||
|
// const rewireSass = require("react-app-rewire-scss");
|
||||||
|
|
||||||
function overrideEslintOptions(options) {
|
function overrideEslintOptions(options) {
|
||||||
// do stuff with the eslint options...
|
// do stuff with the eslint options...
|
||||||
return options;
|
return options;
|
||||||
@@ -7,6 +9,6 @@ function overrideEslintOptions(options) {
|
|||||||
/* global module */
|
/* global module */
|
||||||
module.exports = function override(config, env) {
|
module.exports = function override(config, env) {
|
||||||
config = rewireEslint(config, env, overrideEslintOptions);
|
config = rewireEslint(config, env, overrideEslintOptions);
|
||||||
|
// config = rewireSass(config, env);
|
||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Generated
+3956
-2683
File diff suppressed because it is too large
Load Diff
+13
-3
@@ -8,26 +8,36 @@
|
|||||||
"@storybook/addon-notes": "^3.4.8",
|
"@storybook/addon-notes": "^3.4.8",
|
||||||
"@storybook/react": "^3.4.8",
|
"@storybook/react": "^3.4.8",
|
||||||
"babel-eslint": "^8.2.5",
|
"babel-eslint": "^8.2.5",
|
||||||
|
"babel-register": "^6.26.0",
|
||||||
"eslint": "^5.0.1",
|
"eslint": "^5.0.1",
|
||||||
"eslint-config-recommended": "^3.0.0",
|
"eslint-config-recommended": "^3.0.0",
|
||||||
"eslint-plugin-babel": "^5.1.0",
|
"eslint-plugin-babel": "^5.1.0",
|
||||||
"eslint-plugin-flowtype": "^2.49.3",
|
"eslint-plugin-flowtype": "^2.49.3",
|
||||||
"eslint-plugin-react": "^7.10.0",
|
"eslint-plugin-react": "^7.10.0",
|
||||||
|
"flow": "^0.2.3",
|
||||||
"flow-bin": "^0.75.0",
|
"flow-bin": "^0.75.0",
|
||||||
"flow-typed": "^2.4.0",
|
"flow-typed": "^2.4.0",
|
||||||
"react-app-rewire-eslint": "^0.2.3",
|
"react-app-rewire-eslint": "^0.2.3",
|
||||||
|
"react-app-rewire-scss": "^1.0.2",
|
||||||
"react-app-rewired": "^1.5.2"
|
"react-app-rewired": "^1.5.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"node-sass-chokidar": "^1.3.0",
|
||||||
|
"npm-run-all": "^4.1.3",
|
||||||
"react": "^16.4.1",
|
"react": "^16.4.1",
|
||||||
"react-dom": "^16.4.1"
|
"react-dom": "^16.4.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "react-app-rewired start",
|
"build-css": "node-sass-chokidar src/ -o src/",
|
||||||
"build": "react-app-rewired build",
|
"watch-css": "npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive",
|
||||||
|
"start-js": "react-app-rewired start",
|
||||||
|
"build-js": "react-app-rewired build",
|
||||||
|
"start": "npm-run-all -p watch-css start-js",
|
||||||
|
"build": "npm-run-all build-css build-js",
|
||||||
"test": "react-app-rewired test --env=jsdom",
|
"test": "react-app-rewired test --env=jsdom",
|
||||||
"eject": "react-app-rewired eject",
|
"eject": "react-app-rewired eject",
|
||||||
"storybook": "start-storybook -p 9001 -c .storybook",
|
"storybook-js": "start-storybook -p 9001 -c .storybook",
|
||||||
|
"storybook": "npm-run-all -p watch-css storybook-js",
|
||||||
"build-storybook": "build-storybook -c .storybook -o out_sb",
|
"build-storybook": "build-storybook -c .storybook -o out_sb",
|
||||||
"flow": "flow",
|
"flow": "flow",
|
||||||
"addTypes": "flow-typed install"
|
"addTypes": "flow-typed install"
|
||||||
|
|||||||
+9
-13
@@ -1,28 +1,24 @@
|
|||||||
.App {
|
.App {
|
||||||
text-align: center;
|
text-align: center; }
|
||||||
}
|
|
||||||
|
|
||||||
.App-logo {
|
.App-logo {
|
||||||
animation: App-logo-spin infinite 20s linear;
|
animation: App-logo-spin infinite 20s linear;
|
||||||
height: 80px;
|
height: 80px; }
|
||||||
}
|
|
||||||
|
|
||||||
.App-header {
|
.App-header {
|
||||||
background-color: #222;
|
background-color: #222;
|
||||||
height: 150px;
|
height: 150px;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
color: white;
|
color: green; }
|
||||||
}
|
|
||||||
|
|
||||||
.App-title {
|
.App-title {
|
||||||
font-size: 1.5em;
|
font-size: 1.5em; }
|
||||||
}
|
|
||||||
|
|
||||||
.App-intro {
|
.App-intro {
|
||||||
font-size: large;
|
font-size: large; }
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes App-logo-spin {
|
@keyframes App-logo-spin {
|
||||||
from { transform: rotate(0deg); }
|
from {
|
||||||
to { transform: rotate(360deg); }
|
transform: rotate(0deg); }
|
||||||
}
|
to {
|
||||||
|
transform: rotate(360deg); } }
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import React, { Component } from "react";
|
|||||||
import logo from "./logo.svg";
|
import logo from "./logo.svg";
|
||||||
import "./App.css";
|
import "./App.css";
|
||||||
|
|
||||||
type Props = {}
|
type Props = {};
|
||||||
|
|
||||||
class App extends Component<Props> {
|
class App extends Component<Props> {
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
$micolor: green;
|
||||||
|
|
||||||
|
.App {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-logo {
|
||||||
|
animation: App-logo-spin infinite 20s linear;
|
||||||
|
height: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-header {
|
||||||
|
background-color: #222;
|
||||||
|
height: 150px;
|
||||||
|
padding: 20px;
|
||||||
|
color: $micolor;
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-title {
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-intro {
|
||||||
|
font-size: large;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes App-logo-spin {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
$normalColor: green;
|
||||||
|
$normalText: yellow;
|
||||||
|
|
||||||
|
$alertColor: red;
|
||||||
|
$alertText: white;
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
@mixin darkenBackground($color) {
|
||||||
|
background-color: $color;
|
||||||
|
&:hover {
|
||||||
|
background-color: darken($color, 25%);
|
||||||
|
transition: all 0.5s ease;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin coloredBoldText($color) {
|
||||||
|
color: $color;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/* @flow */
|
||||||
|
|
||||||
|
import React from "react";
|
||||||
|
import PropTypes from "prop-types";
|
||||||
|
import "./styles.css";
|
||||||
|
|
||||||
|
export class SassButton extends React.PureComponent<{
|
||||||
|
normal: boolean,
|
||||||
|
buttonText: string,
|
||||||
|
onSelect: void => void
|
||||||
|
}> {
|
||||||
|
static propTypes = {
|
||||||
|
normal: PropTypes.bool.isRequired,
|
||||||
|
buttonText: PropTypes.string.isRequired,
|
||||||
|
onSelect: PropTypes.func.isRequired
|
||||||
|
};
|
||||||
|
|
||||||
|
onSelect() {
|
||||||
|
this.props.onSelect();
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={
|
||||||
|
this.props.normal ? "normalButton" : "alertButton"
|
||||||
|
}
|
||||||
|
onClick={this.onSelect.bind(this)}
|
||||||
|
>
|
||||||
|
<span>{this.props.buttonText}</span>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { storiesOf } from "@storybook/react";
|
||||||
|
import { action } from "@storybook/addon-actions";
|
||||||
|
|
||||||
|
import { SassButton } from "./";
|
||||||
|
|
||||||
|
storiesOf("SASS buttons", module)
|
||||||
|
.add("normal style", () => (
|
||||||
|
<SassButton
|
||||||
|
normal
|
||||||
|
buttonText={"A normal SASSy button!"}
|
||||||
|
onSelect={action("click:normal")}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
.add("alert style", () => (
|
||||||
|
<SassButton
|
||||||
|
normal={false}
|
||||||
|
buttonText={"An alert SASSy button!"}
|
||||||
|
onSelect={action("click:alert")}
|
||||||
|
/>
|
||||||
|
));
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
.normalButton, .alertButton {
|
||||||
|
display: inline-block;
|
||||||
|
text-decoration: none;
|
||||||
|
padding: 5px 10px;
|
||||||
|
border-radius: 3px; }
|
||||||
|
|
||||||
|
.normalButton {
|
||||||
|
background-color: green; }
|
||||||
|
.normalButton:hover {
|
||||||
|
background-color: #000100;
|
||||||
|
transition: all 0.5s ease; }
|
||||||
|
.normalButton span {
|
||||||
|
color: yellow;
|
||||||
|
font-weight: bold; }
|
||||||
|
|
||||||
|
.alertButton {
|
||||||
|
background-color: red; }
|
||||||
|
.alertButton:hover {
|
||||||
|
background-color: maroon;
|
||||||
|
transition: all 0.5s ease; }
|
||||||
|
.alertButton span {
|
||||||
|
color: white;
|
||||||
|
font-weight: bold; }
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
@import "_constants.scss";
|
||||||
|
// @import "_darken.scss";
|
||||||
|
// @import "_coloredText.scss";
|
||||||
|
@import "_mixins.scss";
|
||||||
|
|
||||||
|
%baseButton {
|
||||||
|
display: inline-block;
|
||||||
|
text-decoration: none;
|
||||||
|
padding: 5px 10px;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.normalButton {
|
||||||
|
@extend %baseButton;
|
||||||
|
@include darkenBackground($normalColor);
|
||||||
|
|
||||||
|
span {
|
||||||
|
@include coloredBoldText($normalText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.alertButton {
|
||||||
|
@extend %baseButton;
|
||||||
|
@include darkenBackground($alertColor);
|
||||||
|
|
||||||
|
span {
|
||||||
|
@include coloredBoldText($alertText);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-family: sans-serif;
|
font-family: Helvetica, sans-serif; }
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import React from 'react';
|
import React from "react";
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from "react-dom";
|
||||||
import './index.css';
|
import "./App.scss";
|
||||||
import App from './App';
|
import App from "./App";
|
||||||
import registerServiceWorker from './registerServiceWorker';
|
import registerServiceWorker from "./registerServiceWorker";
|
||||||
|
|
||||||
ReactDOM.render(<App />, document.getElementById('root'));
|
ReactDOM.render(<App />, document.getElementById("root"));
|
||||||
registerServiceWorker();
|
registerServiceWorker();
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
$font-stack: Helvetica, sans-serif;
|
||||||
|
$real-margin: 0;
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: $real-margin;
|
||||||
|
padding: 0;
|
||||||
|
font-family: $font-stack;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user