Skip to content

Commit 512e0d3

Browse files
committed
turn styles into objects, fix action link
1 parent 7573f3a commit 512e0d3

File tree

7 files changed

+74
-67
lines changed

7 files changed

+74
-67
lines changed

lib/components/Page/Task/index.js

+18-16
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,23 @@ var taskCheckbox_1 = require('./taskCheckbox');
55
var List_1 = require('material-ui/List');
66
var colors_1 = require('material-ui/styles/colors');
77
var styles = {
8-
margin: '5px',
9-
padding: '5px',
10-
position: 'relative'
11-
};
12-
var indexStyles = {
13-
position: 'absolute',
14-
top: '20px',
15-
left: '45px',
16-
};
17-
var descriptionStyles = {
18-
backgroundColor: 'inherit',
19-
paddingTop: '-10px',
20-
paddingLeft: '55px',
21-
fontSize: '14px',
22-
lineHeight: '1.6',
8+
task: {
9+
margin: '5px',
10+
padding: '5px',
11+
position: 'relative'
12+
},
13+
index: {
14+
position: 'absolute',
15+
top: '20px',
16+
left: '45px',
17+
},
18+
description: {
19+
backgroundColor: 'inherit',
20+
paddingTop: '-10px',
21+
paddingLeft: '55px',
22+
fontSize: '14px',
23+
lineHeight: '1.6',
24+
},
2325
};
2426
function getStatus(index, taskPosition, testRun) {
2527
return index < taskPosition ? colors_1.lightGreen200 : 'inherit';
@@ -28,7 +30,7 @@ var Task = function (_a) {
2830
var task = _a.task, taskPosition = _a.taskPosition, index = _a.index, testRun = _a.testRun;
2931
var backgroundColor = getStatus(index, taskPosition, testRun);
3032
var isCurrentTask = taskPosition === index;
31-
return (React.createElement(List_1.ListItem, {key: index, style: Object.assign({}, styles, { backgroundColor: backgroundColor })}, taskCheckbox_1.default(isCurrentTask, testRun), React.createElement("span", {style: indexStyles}, index + 1, "."), React.createElement("div", {style: descriptionStyles}, React.createElement(index_1.Markdown, null, task.description))));
33+
return (React.createElement(List_1.ListItem, {key: index, style: Object.assign({}, styles.task, { backgroundColor: backgroundColor })}, taskCheckbox_1.default(isCurrentTask, testRun), React.createElement("span", {style: styles.index}, index + 1, "."), React.createElement("div", {style: styles.description}, React.createElement(index_1.Markdown, null, task.description))));
3234
};
3335
Object.defineProperty(exports, "__esModule", { value: true });
3436
exports.default = Task;

lib/components/Page/TasksComplete/index.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,21 @@ var Card_1 = require('material-ui/Card');
44
var index_1 = require('../../index');
55
var colors_1 = require('material-ui/styles/colors');
66
var styles = {
7-
backgroundColor: colors_1.cyan500,
8-
margin: '10px 5px',
9-
};
10-
var textStyles = {
11-
color: colors_1.grey100,
12-
fontSize: '1.1em'
7+
card: {
8+
backgroundColor: colors_1.cyan500,
9+
margin: '10px 5px',
10+
},
11+
text: {
12+
color: colors_1.grey100,
13+
fontSize: '1.1em'
14+
},
1315
};
1416
var TasksComplete = function (_a) {
1517
var page = _a.page, completed = _a.completed;
1618
if (!completed || !page.onPageComplete) {
1719
return null;
1820
}
19-
return (React.createElement(Card_1.Card, {style: styles}, React.createElement(Card_1.CardText, null, React.createElement(index_1.Markdown, {style: textStyles}, page.onPageComplete))));
21+
return (React.createElement(Card_1.Card, {style: styles.card}, React.createElement(Card_1.CardText, null, React.createElement(index_1.Markdown, {style: styles.text}, page.onPageComplete))));
2022
};
2123
Object.defineProperty(exports, "__esModule", { value: true });
2224
exports.default = TasksComplete;

lib/components/Progress/index.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ var List_1 = require('material-ui/List');
2020
var Subheader_1 = require('material-ui/Subheader');
2121
var ProgressPage_1 = require('./ProgressPage');
2222
var actions_1 = require('../../modules/progress/actions');
23-
var pageStyle = {
24-
width: '100%',
25-
};
26-
var listStyle = {
27-
margin: '5px',
23+
var styles = {
24+
page: {
25+
width: '100%',
26+
},
27+
list: {
28+
margin: '5px',
29+
},
2830
};
2931
var Progress = (function (_super) {
3032
__extends(Progress, _super);
@@ -36,7 +38,7 @@ var Progress = (function (_super) {
3638
};
3739
Progress.prototype.render = function () {
3840
var _a = this.props, progress = _a.progress, pagePosition = _a.pagePosition, info = _a.info, tutorial = _a.tutorial;
39-
return (React.createElement(Paper_1.default, {style: pageStyle}, React.createElement(List_1.List, {style: listStyle}, React.createElement(Subheader_1.default, null, info.name), tutorial.pages.map(function (page, index) { return (React.createElement(ProgressPage_1.default, {key: index, index: index, page: page, pagePosition: pagePosition, progress: progress})); }))));
41+
return (React.createElement(Paper_1.default, {style: styles.page}, React.createElement(List_1.List, {style: styles.list}, React.createElement(Subheader_1.default, null, info.name), tutorial.pages.map(function (page, index) { return (React.createElement(ProgressPage_1.default, {key: index, index: index, page: page, pagePosition: pagePosition, progress: progress})); }))));
4042
};
4143
Progress = __decorate([
4244
react_redux_1.connect(null, function (dispatch) {

src/actions.ts

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export {setupVerify, setupPackage} from './modules/setup/actions';
66
export {tutorialSet} from './modules/tutorial';
77
export {tutorialsFind, tutorialUpdate} from './modules/tutorials';
88

9-
109
export {alertOpen, alertClose, alertReplay} from 'core-coderoad/lib/alert';
1110
export {editorDevToolsToggle, editorOpen, editorInsert,
1211
editorSave, editorSet} from 'core-coderoad/lib/editor';

src/components/Page/Task/index.tsx

+20-20
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ import {ListItem} from 'material-ui/List';
55
import {lightGreen200, orange200} from 'material-ui/styles/colors';
66

77
const styles = {
8-
margin: '5px',
9-
padding: '5px',
10-
position: 'relative'
11-
};
12-
13-
const indexStyles = {
14-
position: 'absolute',
15-
top: '20px',
16-
left: '45px',
17-
};
18-
19-
const descriptionStyles = {
20-
backgroundColor: 'inherit',
21-
paddingTop: '-10px',
22-
paddingLeft: '55px',
23-
fontSize: '14px',
24-
lineHeight: '1.6',
8+
task: {
9+
margin: '5px',
10+
padding: '5px',
11+
position: 'relative'
12+
},
13+
index: {
14+
position: 'absolute',
15+
top: '20px',
16+
left: '45px',
17+
},
18+
description: {
19+
backgroundColor: 'inherit',
20+
paddingTop: '-10px',
21+
paddingLeft: '55px',
22+
fontSize: '14px',
23+
lineHeight: '1.6',
24+
},
2525
};
2626

2727
function getStatus(
@@ -38,11 +38,11 @@ const Task: React.StatelessComponent<{
3838
return (
3939
<ListItem
4040
key={index}
41-
style={Object.assign({}, styles, {backgroundColor})}
41+
style={Object.assign({}, styles.task, {backgroundColor})}
4242
>
4343
{taskCheckbox(isCurrentTask, testRun)}
44-
<span style={indexStyles}>{index + 1}.</span>
45-
<div style={descriptionStyles}>
44+
<span style={styles.index}>{index + 1}.</span>
45+
<div style={styles.description}>
4646
<Markdown >{task.description}</Markdown>
4747
</div>
4848
</ListItem>

src/components/Page/TasksComplete/index.tsx

+10-9
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@ import {Markdown} from '../../index';
44
import {cyan500, grey100} from 'material-ui/styles/colors';
55

66
const styles = {
7-
backgroundColor: cyan500,
8-
margin: '10px 5px',
9-
};
10-
11-
const textStyles = {
12-
color: grey100,
13-
fontSize: '1.1em'
7+
card: {
8+
backgroundColor: cyan500,
9+
margin: '10px 5px',
10+
},
11+
text: {
12+
color: grey100,
13+
fontSize: '1.1em'
14+
},
1415
};
1516

1617
const TasksComplete: React.StatelessComponent<{
1718
page: CR.Page, completed: boolean
1819
}> = ({page, completed}) => {
1920
if (!completed || !page.onPageComplete) { return null; }
2021
return (
21-
<Card style={styles}>
22+
<Card style={styles.card}>
2223
<CardText>
23-
<Markdown style={textStyles}>{page.onPageComplete}</Markdown>
24+
<Markdown style={styles.text}>{page.onPageComplete}</Markdown>
2425
</CardText>
2526
</Card>
2627
);

src/components/Progress/index.tsx

+9-8
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ import Subheader from 'material-ui/Subheader';
66
import ProgressPage from './ProgressPage';
77
import {progressLoad} from '../../modules/progress/actions';
88

9-
const pageStyle = {
10-
width: '100%',
11-
};
12-
13-
const listStyle = {
14-
margin: '5px',
9+
const styles = {
10+
page: {
11+
width: '100%',
12+
},
13+
list: {
14+
margin: '5px',
15+
},
1516
};
1617

1718
@connect(null, dispatch => {
@@ -29,8 +30,8 @@ export default class Progress extends React.Component<{
2930
render() {
3031
const {progress, pagePosition, info, tutorial} = this.props;
3132
return (
32-
<Paper style={pageStyle}>
33-
<List style={listStyle}>
33+
<Paper style={styles.page}>
34+
<List style={styles.list}>
3435
<Subheader>{info.name}</Subheader>
3536
{tutorial.pages.map((page: CR.Page, index: number) => (
3637
<ProgressPage

0 commit comments

Comments
 (0)