This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section class="card"> | |
<div class="card--content"></div> | |
<div class="card--content"></div> | |
<div class="card--content"></div> | |
<div class="card--content"></div> | |
<div class="card--content"></div> | |
<div class="card--content"></div> | |
<div class="card--content"></div> | |
<div class="card--content"></div> | |
<div class="card--content"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html, | |
body { | |
width: 100%; | |
height: 100%; | |
} | |
body { | |
background-color: #8e44ad; | |
margin: 0; | |
display: flex; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.card { | |
background-color: #fff; | |
min-width: 100%; | |
min-height: 200px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.card--content { | |
background-color: #e74c3c; | |
min-width: 200px; | |
margin: 5px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function updateCardTextReducer(cardId, event) { | |
event.persist(); | |
return function updateCard(state) { | |
const {cards, cardIds} = state; | |
const index = cardIds.indexOf(cardId); | |
const card = getCardById(cardId, cards); | |
const newCardUpdatedText = { | |
...card, | |
text: event.target.value | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const DEFAULT_STATE = { | |
cards: [ | |
{ | |
id: 1234, | |
text: defaultTextForCards, | |
isActiveCard: true | |
}, | |
{ | |
id: '12d3x4', | |
text: defaultTextForCards, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function getCardById (id, cards) { | |
const cardArr = cards.filter(card => { | |
return card.id === id; | |
}); | |
return cardArr[0]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const shortid = require("shortid"); // shortid.generate() returns a unique "short" id | |
const txtgen = require("txtgen"); // txtgen.sentence() returns random "readable" sentences | |
const faker = require("faker"); // faker is used for generating random fake data. | |
const _ = require("lodash"); // lodash is a utility lib for Javascript | |
const users = generateUsers(10); | |
export const contacts = _.mapKeys(users, "user_id"); | |
export const getMessages = messagesPerUser => { | |
let messages = {}; | |
_.forEach(users, user => { |
OlderNewer