Skip to content

Commit

Permalink
header
Browse files Browse the repository at this point in the history
  • Loading branch information
Guido committed Oct 14, 2017
1 parent 8a7c6c2 commit 45682a5
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 4 deletions.
36 changes: 36 additions & 0 deletions src/components/Header/Header.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react';
import moment from 'moment';

import css from './Header.scss';


export class Header extends React.Component {
render() {
const {printDate, title, author, editor} = this.props;
const date = moment(printDate);

console.log(this.props, date);

return (
<div className={css.headerContainer}>
<div className={css.title}>
<span className={css.dayName}>
{date.format('dddd')}{' '}
</span>
{date.format('LL')}
</div>
<div className={css.subtitle}>
<span>
"{title}"
</span>
<span className={css.subtitleItem}>
By {author}
</span>
<span className={css.subtitleItem}>
Edited by {editor}
</span>
</div>
</div>
);
}
}
27 changes: 27 additions & 0 deletions src/components/Header/Header.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.headerContainer {
padding: 25px;
}

.title {
font-size: 40px;
font-weight: 200;
line-height: 56px;
}

.dayName {
font-weight: 700;
}

.subtitle {
font-weight: 200;
font-size: 14px;
}

.subtitleItem {
margin-left: 8px;
}

.subtitleItem::before {
content: "\25AA";
margin-right: 8px;
}
7 changes: 3 additions & 4 deletions src/pages/Puzzle/Puzzle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Grid } from 'components/Grid/Grid';
import { ClueList } from 'components/ClueList/ClueList';
import { ActiveClue } from 'components/ActiveClue/ActiveClue';
import { Toolbar } from 'components/Toolbar/Toolbar';
import { Header } from 'components/Header/Header';

import { across, down } from 'constants/clue';
import {
Expand Down Expand Up @@ -81,15 +82,13 @@ class Puzzle extends React.Component {
return <div>not found...</div>;
}

const { clues, activeDirection, activeCellNumber, cells } = puzzle;
const { clues, activeDirection, activeCellNumber, cells, puzzleMeta } = puzzle;
const activeCell = cells[activeCellNumber];
const activeClue = clues[activeDirection][activeCell.cellClues[activeDirection]];

return (
<div className={css.puzzleContainer}>
<div className={css.headerContainer}>
header
</div>
<Header {...puzzleMeta} />
<Toolbar
clearOption={this.props.clearOption}
revealOption={this.props.revealOption}
Expand Down
1 change: 1 addition & 0 deletions src/utils/puzzle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,5 +281,6 @@ export const initializePuzzle = (puzzleObject) => {
clues: cluesByNumber,
activeCellNumber: 0,
activeDirection: across,
puzzleMeta: puzzleObject.puzzle_meta,
};
};

0 comments on commit 45682a5

Please sign in to comment.