This file contains hidden or 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
| import styled, { css } from 'styled-components' | |
| // Readable Style | |
| const style = css` | |
| list-style: none; | |
| li { | |
| margin-bottom: 7px; | |
| } | |
| ` |
This file contains hidden or 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
| import styled from 'styled-components' | |
| /* | |
| * Wrapping a custom component | |
| */ | |
| const UnorderedList = styled(({ children, ...rest }) => ( | |
| <ul {...rest}> | |
| { children } | |
| </ul> | |
| ))` |
This file contains hidden or 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
| import styled from 'styled-components' | |
| /* | |
| * Using the shorthand tag name 'ul' | |
| */ | |
| const UnorderedList = styled.ul` | |
| list-style: none; | |
| li { | |
| margin-bottom: 7px; |
This file contains hidden or 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
| import schema from './schema'; | |
| import { ACTIONS } from './action'; | |
| const fetching = substate => (state, action) => { | |
| return { | |
| ...state, | |
| [substate]: { | |
| ...state[substate], | |
| ...action.value, | |
| fetching: true |
This file contains hidden or 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
| import schema from './schema'; | |
| import { ACTIONS } from './action'; | |
| export default (state = schema, action) => { | |
| switch (action.type) { | |
| case ACTIONS.FETCHING_LIST: | |
| return { | |
| ...state, | |
| list: { |
This file contains hidden or 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
| import schema from './schema'; | |
| import { ACTIONS } from './action'; | |
| export default (state = schema, action) => { | |
| switch (action.type) { | |
| case ACTIONS.FETCHING: | |
| return { | |
| ...state, | |
| isFetching: true |
This file contains hidden or 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
| function flattenDeep(arr) { | |
| return arr.reduce((acc, val) => Array.isArray(val) ? acc.concat(flattenDeep(val)) : acc.concat(val), []); | |
| } | |
| flattenDeep([[1,2,[3]],4]); |
This file contains hidden or 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
| /** | |
| Fullscreen Class | |
| */ | |
| class Fullscreen { | |
| constructor() { | |
| document.cancelFullScreen = document.webkitCancelFullScreen || document.mozCancelFullScreen || document.cancelFullScreen; |
NewerOlder