Skip to content

Instantly share code, notes, and snippets.

@Lelith
Lelith / eslint
Created May 2, 2018 15:08
my eslinter setup, including exceptions that i found useful in my projects
{
"extends": "airbnb",
"rules": {
"func-names": ["error", "never"],
"no-return-assign": 0,
"react/forbid-prop-types": 0,
"react/no-array-index-key": 0,
"import/prefer-default-export": 0,
"import/no-extraneous-dependencies": [
"error",
@Lelith
Lelith / response.json
Last active August 16, 2018 09:23
appointments
{
"stylist":"Daniela",
"date":{"date":"2018-08-16"},
"slot":{"slot":"08:00"},
"orderConfirmationComment":{"orderConfirmationComment":"Thank you for your help!"},
"phone":{"phone":"+4914128872"}
}
@Lelith
Lelith / counter.js
Created December 14, 2019 15:33
Counter Component
/* src/components/Counter/index.js */
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames/bind';
import './index.css';
const Counter = (props) => {
const {
amount,
...other
@Lelith
Lelith / counter.test.js
Created December 14, 2019 15:36
Counter test
/* src/components/Counter/test/Counter.test.js */
import React from 'react'
import Counter from '../';
describe('Counter', () => {
it('increases the amount on plus interaction', () => {
// tbd
});
it('decreases the amount on minus interaction', () => {
// tbd
@Lelith
Lelith / Counter.stories.js
Created December 14, 2019 15:42
Counter Story
/* stories/Counter.stories.js */
import React from 'react';
import { storiesOf } from '@storybook/react';
import Counter from './../src/components/Counter';
storiesOf('Components', module)
.addParameters({
info: {
inline: true,
header: false
@Lelith
Lelith / addons.js
Last active December 15, 2019 07:55
storybook addon a11y
/* .storybook/addons.js */
import '@storybook/addon-actions/register';
import '@storybook/addon-links/register';
import '@storybook/addon-a11y/register';
@Lelith
Lelith / config.js
Created December 15, 2019 07:54
storybook config a11y
/* .storybook/config.js */
import { configure, addDecorator } from '@storybook/react';
import { withA11y } from '@storybook/addon-a11y';
addDecorator(withA11y);
// automatically import all files ending in *.stories.js
configure(require.context('../stories', true, /\.stories\.js$/), module);
@Lelith
Lelith / counter-index.js
Last active December 18, 2019 15:49
input fix
/* src/components/Counter/index.js */
...
return (
<div class={counterClasses} {...other}>
<button>
-
</button>
<input type='text' readonly value={amount} aria-label="current amount"/>
<button>
@Lelith
Lelith / activity1.js
Created December 26, 2019 14:58
svg rectangle
/* src/components/Calendar/index.js */
import React from 'react';
import PropTypes from 'prop-types';
const Calendar = (props) => {
const {
data,
...other
} = props;
@Lelith
Lelith / activity2.js
Created December 26, 2019 15:09
calculate average
function calcAverage(data){
const sum = data.reduce((a, b) => a + b, 0);
return sum / data.length;
}