Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Initial code copied from brianlovin.com
Browse files Browse the repository at this point in the history
  • Loading branch information
brianlovin committed Jan 13, 2019
1 parent 32d9b44 commit 5fa7d5e
Show file tree
Hide file tree
Showing 56 changed files with 13,802 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .babelrc
@@ -0,0 +1,14 @@
{
"presets": ["next/babel"],
"plugins": [
"transform-flow-strip-types",
[
"styled-components",
{
"ssr": true,
"displayName": true,
"preprocess": false
}
]
]
}
126 changes: 126 additions & 0 deletions .eslintrc.json
@@ -0,0 +1,126 @@
{
"extends": [
"airbnb",
"prettier",
"plugin:react/recommended"
],
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 8,
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"impliedStrict": true,
"classes": true
}
},
"env": {
"browser": true,
"node": true,
"jquery": true,
"jest": true
},
"rules": {
"no-debugger": 0,
"no-alert": 0,
"no-unused-vars": [
1,
{
"ignoreSiblings": true,
"argsIgnorePattern": "res|next|^err"
}
],
"prefer-const": [
"error",
{
"destructuring": "all"
}
],
"arrow-body-style": [
2,
"as-needed"
],
"no-unused-expressions": [
2,
{
"allowTaggedTemplates": true
}
],
"no-param-reassign": [
2,
{
"props": false
}
],
"no-console": 0,
"import/prefer-default-export": 0,
"import": 0,
"func-names": 0,
"space-before-function-paren": 0,
"comma-dangle": 0,
"max-len": 0,
"import/extensions": 0,
"no-underscore-dangle": 0,
"consistent-return": 0,
"react/display-name": 1,
"react/no-array-index-key": 0,
"react/react-in-jsx-scope": 0,
"react/prefer-stateless-function": 0,
"react/forbid-prop-types": 0,
"react/no-unescaped-entities": 0,
"jsx-a11y/accessible-emoji": 0,
"react/jsx-one-expression-per-line": 0,
"react/require-default-props": 0,
"react/jsx-filename-extension": [
1,
{
"extensions": [
".js",
".jsx"
]
}
],
"radix": 0,
"no-shadow": [
2,
{
"hoist": "all",
"allow": [
"resolve",
"reject",
"done",
"next",
"err",
"error"
]
}
],
"quotes": [
2,
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": true
}
],
"prettier/prettier": [
"error",
{
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 80
}
],
"jsx-a11y/href-no-hash": "off",
"jsx-a11y/anchor-is-valid": [
"warn",
{
"aspects": [
"invalidHref"
]
}
]
},
"plugins": [
"prettier"
]
}
26 changes: 26 additions & 0 deletions .flowconfig
@@ -0,0 +1,26 @@
[ignore]
<PROJECT_ROOT>/node_modules

[include]

[libs]
./flow-typed

[options]
suppress_comment=.*\\$FlowFixMe
suppress_comment=.*\\$FlowIssue
esproposal.class_instance_fields=enable
module.system.node.resolve_dirname=node_modules
module.system.node.resolve_dirname=.
module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json

[lints]
untyped-type-import=error
untyped-import=warn
unclear-type=warn
unsafe-getters-setters=error

[version]
0.90.0
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,6 +4,7 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.DS_Store

# Runtime data
pids
Expand Down
11 changes: 11 additions & 0 deletions .prettierrc.json
@@ -0,0 +1,11 @@
{
"prettier.printWidth": 120,
"prettier.tabWidth": 2,
"prettier.singleQuote": true,
"prettier.trailingComma": "none",
"prettier.bracketSpacing": true,
"prettier.parser": "flow",
"prettier.semi": true,
"prettier.useTabs": false,
"prettier.jsxBracketSameLine": false
}
19 changes: 19 additions & 0 deletions .travis.yml
@@ -0,0 +1,19 @@
language: node_js
node_js:
- 10
cache:
directories:
- ~/.npm
- ~/.cache
install:
- npm install
before_script:
- npm run build
- npm run start &
script:
- node --version
- npm --version
- npm run flow
- npm run cypress:run
notifications:
email: false
9 changes: 9 additions & 0 deletions components/Button/Button.js
@@ -0,0 +1,9 @@
// @flow
import React from 'react';
import * as Styled from './style';
import type { ButtonProps } from './types';

export default function Button(props: ButtonProps) {
const { children } = props;
return <Styled.Button {...props}>{children}</Styled.Button>;
}
45 changes: 45 additions & 0 deletions components/Button/CopyLinkButton.js
@@ -0,0 +1,45 @@
// @flow
// $FlowIssue
import React, { useState } from 'react';
import dynamic from 'next/dynamic';
import * as Styled from './style';
import Icon from '../Icon';
import type { ButtonProps } from './types';

const Clipboard = dynamic(() => import('react-clipboard.js'), {
ssr: false,
loading: () => null,
});

type CopyLinkProps = {
...$Exact<ButtonProps>,
text: string,
};

export default function CopyLinkButton(props: CopyLinkProps) {
const { text, children } = props;
const [isClicked, handleClick] = useState(false);

const onClick = () => {
handleClick(true);
setTimeout(() => handleClick(false), 2000);
};

return (
<Clipboard
style={{ background: 'none' }}
data-clipboard-text={text}
onSuccess={onClick}
component="a"
>
<Styled.CopyLinkButton
data-cy="copy-link-button"
isClicked={isClicked}
{...props}
>
<Icon glyph="link" size={24} />
{isClicked ? 'Copied!' : children}
</Styled.CopyLinkButton>
</Clipboard>
);
}
15 changes: 15 additions & 0 deletions components/Button/FacebookButton.js
@@ -0,0 +1,15 @@
// @flow
import React from 'react';
import * as Styled from './style';
import Icon from '../Icon';
import type { ButtonProps } from './types';

export default function FacebookButton(props: ButtonProps) {
const { children } = props;
return (
<Styled.FacebookButton {...props}>
<Icon glyph="facebook" size={24} />
{children}
</Styled.FacebookButton>
);
}
9 changes: 9 additions & 0 deletions components/Button/GhostButton.js
@@ -0,0 +1,9 @@
// @flow
import React from 'react';
import * as Styled from './style';
import type { ButtonProps } from './types';

export default function GhostButton(props: ButtonProps) {
const { children } = props;
return <Styled.GhostButton {...props}>{children}</Styled.GhostButton>;
}
9 changes: 9 additions & 0 deletions components/Button/OutlineButton.js
@@ -0,0 +1,9 @@
// @flow
import React from 'react';
import * as Styled from './style';
import type { ButtonProps } from './types';

export default function OutlineButton(props: ButtonProps) {
const { children } = props;
return <Styled.OutlineButton {...props}>{children}</Styled.OutlineButton>;
}
9 changes: 9 additions & 0 deletions components/Button/PrimaryButton.js
@@ -0,0 +1,9 @@
// @flow
import React from 'react';
import * as Styled from './style';
import type { ButtonProps } from './types';

export default function PrimaryButton(props: ButtonProps) {
const { children } = props;
return <Styled.PrimaryButton {...props}>{children}</Styled.PrimaryButton>;
}
15 changes: 15 additions & 0 deletions components/Button/TwitterButton.js
@@ -0,0 +1,15 @@
// @flow
import React from 'react';
import * as Styled from './style';
import Icon from '../Icon';
import type { ButtonProps } from './types';

export default function TwitterButton(props: ButtonProps) {
const { children } = props;
return (
<Styled.TwitterButton {...props}>
<Icon glyph="twitter" size={24} />
{children}
</Styled.TwitterButton>
);
}
22 changes: 22 additions & 0 deletions components/Button/index.js
@@ -0,0 +1,22 @@
// @flow
import * as Styled from './style';
import Button from './Button';
import CopyLinkButton from './CopyLinkButton';
import FacebookButton from './FacebookButton';
import GhostButton from './GhostButton';
import OutlineButton from './OutlineButton';
import PrimaryButton from './PrimaryButton';
import TwitterButton from './TwitterButton';

const { ButtonRow } = Styled;

export {
Button,
CopyLinkButton,
FacebookButton,
GhostButton,
OutlineButton,
PrimaryButton,
TwitterButton,
ButtonRow,
};

0 comments on commit 5fa7d5e

Please sign in to comment.