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 React from "react"; | |
import styled from "react-emotion"; | |
import { Flex, Box } from "grid-styled/emotion"; | |
import Text from "./Text"; | |
import Avatar from "./Avatar"; | |
const Comment = ({ children, ...props }) => children(props); | |
Comment.defaultProps = { | |
Wrapper: props => <Flex flexDirection="row" mb={"1rem"} {...props} />, |
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 initToggle({ | |
TOGGLE_SELECTOR = ".js-toggle", | |
TOGGLE_FOCUSED_CLASS = "toggle--focused", | |
TOGGLE_ITEM_OPEN_CLASS = "toggle__item--open", // use constants for class names and selectors variable name should end with _CLASS or _SELECTOR | |
}) { // use init functions that encapsulate functionality | |
const $toggle = $(TOGGLE_SELECTOR); // jQuery objects variable names should start with $ for jQuery elements | |
$toggle.on("focus", (event) => { | |
const $this = $(event.currentTarget); | |
$this.addClass(TOGGLE_FOCUSED_CLASS); |
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
your-project/ | |
├── scss | |
│ ├── variables.scss | |
│ └── custom.scss | |
└── node_modules/ | |
└── bootstrap | |
├── js | |
└── scss |
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
// Custom.scss | |
// Option B: Include parts of Bootstrap | |
// Required | |
@import "node_modules/bootstrap/scss/functions"; | |
// Bootstrap default variables | |
@import "node_modules/bootstrap/scss/variables"; | |
// Your variable overrides | |
@import "./variables"; | |
@import "node_modules/bootstrap/scss/mixins"; |
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 tomorrowDate() { | |
const date = new Date(); | |
date.setDate(date.getDate() + 1); | |
return date; | |
} | |
it("Test tomorrowDate function", () => { | |
expect(tomorrowDate()).toBe(/* ¯\_(ツ)_/¯ - it is imposible to test the function */) |
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 addDays(date = new Date(), days = 0) { | |
const dateClone = new Date(date); // date is an object provided by reference, we need to clone it | |
dateClone.setDate(date.getDate() + days); | |
return dateClone; | |
} | |
const tomorrowDate = (date, days = 1) => addDays(date, days); |
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
Original Value | Converted to Number | Converted to String | Converted to Boolean | |
---|---|---|---|---|
false | 0 | false | false | |
true | 1 | true | true | |
0 | 0 | 0 | false | |
1 | 1 | 1 | true | |
0 | 0 | 0 | true | |
000 | 0 | 000 | true | |
1 | 1 | 1 | true | |
NaN | NaN | NaN | false | |
Infinity | Infinity | Infinity | 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
Calendar.defaultProps = { | |
Wrapper: styled.div` | |
display: flex; | |
flex-direction: row; | |
`, | |
Column: styled.div` | |
display: flex; | |
flex-direction: column; | |
margin: 0.5rem; | |
`, |
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 React from "react"; | |
import ReactDOM from "react-dom"; | |
import Calendar from "./components/Calendar"; | |
const App = () => ( | |
<> | |
<Calendar> | |
{({ Wrapper, Column, Box, Item, headers }) => ( | |
<Wrapper> | |
{headers.map((header, index) => ( |
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
// see types of prompts: | |
// https://github.com/enquirer/enquirer/tree/master/examples | |
// | |
module.exports = [ | |
{ | |
type: "input", | |
name: "name", | |
message: "What's the name of your package?" | |
}, | |
{ |