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

Commit

Permalink
Added add button
Browse files Browse the repository at this point in the history
  • Loading branch information
willemliu committed Feb 18, 2019
1 parent 3d7bc21 commit ce0a7b9
Show file tree
Hide file tree
Showing 9 changed files with 198 additions and 130 deletions.
6 changes: 5 additions & 1 deletion demo/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom';
import {ButtonCallToAction, ButtonEditorial, FollowButton} from "../src/Buttons";
import {AddButton, ButtonCallToAction, ButtonEditorial, FollowButton} from "../src/Buttons";
import { createGlobalStyle } from 'styled-components';

function handleClick() {
Expand Down Expand Up @@ -33,5 +33,9 @@ ReactDOM.render(<>
<div><FollowButton buttonStyle="default" onClick={handleClick} selected={true} tag="tag2">.fd-follow-button</FollowButton></div>
<div><FollowButton buttonStyle="persoonlijk" onClick={handleClick} tag="tag3">.fd-follow-button.persoonlijk</FollowButton></div>
<div><FollowButton buttonStyle="persoonlijk" onClick={handleClick} selected={true} tag="tag3">.fd-follow-button.persoonlijk</FollowButton></div>

<div><AddButton buttonStyle="default" onClick={handleClick}>.fd-add-button</AddButton></div>
<div><AddButton buttonStyle="persoonlijk" onClick={handleClick}>.fd-add-button.persoonlijk</AddButton></div>

</>,
document.getElementById('root'));
12 changes: 12 additions & 0 deletions dist/AddButton.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React, { PureComponent } from "react";
export declare type ButtonTypes = 'default' | 'persoonlijk';
export interface Props {
buttonStyle: ButtonTypes;
className?: string;
onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
}
export default class AddButton extends PureComponent<any, any> {
render(): JSX.Element;
}
declare const GlobalStyle: import("styled-components").GlobalStyleComponent<{}, import("styled-components").DefaultTheme>;
export { GlobalStyle as AddButtonStyle };
5 changes: 2 additions & 3 deletions dist/Buttons.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import AddButton, { AddButtonStyle } from './AddButton';
import ButtonCallToAction, { ButtonCallToActionStyles } from './ButtonCta';
import ButtonEditorial, { ButtonEditorialStyles } from './ButtonEditorial';
import FollowButton, { FollowButtonStyle } from './FollowButton';
export { ButtonCallToAction, ButtonCallToActionStyles };
export { ButtonEditorial, ButtonEditorialStyles };
export { FollowButton, FollowButtonStyle };
export { AddButton, AddButtonStyle, ButtonCallToAction, ButtonCallToActionStyles, ButtonEditorial, ButtonEditorialStyles, FollowButton, FollowButtonStyle };
2 changes: 1 addition & 1 deletion dist/buttons.js

Large diffs are not rendered by default.

242 changes: 126 additions & 116 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fdmg/fd-buttons",
"version": "1.0.16",
"version": "1.0.17",
"description": "FD-themed buttons",
"types": "dist/Buttons.d.ts",
"main": "dist/buttons.js",
Expand Down Expand Up @@ -38,9 +38,9 @@
"author": "Willem Liu",
"license": "ISC",
"devDependencies": {
"@types/jest": "^24.0.5",
"@types/jest": "^24.0.6",
"@types/react": "^16.8.3",
"@types/react-dom": "^16.8.1",
"@types/react-dom": "^16.8.2",
"@types/react-test-renderer": "^16.8.1",
"@types/styled-components": "^4.1.10",
"@types/webpack-env": "^1.13.7",
Expand All @@ -57,7 +57,7 @@
"tslint": "^5.12.1",
"tslint-react": "^3.6.0",
"typescript": "^3.3.3",
"webpack": "^4.29.3",
"webpack": "^4.29.5",
"webpack-cli": "^3.2.3"
},
"dependencies": {
Expand Down
41 changes: 41 additions & 0 deletions src/AddButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React, { PureComponent } from "react";
import { createGlobalStyle } from "styled-components";

export type ButtonTypes = 'default' | 'persoonlijk';

export interface Props {
buttonStyle: ButtonTypes;
className?: string;
onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
}

export default class AddButton extends PureComponent<any, any> {
render() {
return (
<>
<GlobalStyle/>
<button className={`fd-add-button${this.props.className ? ` ${this.props.className}` : ''}${this.props.buttonStyle ? ` ${this.props.buttonStyle}` : ''}`} onClick={this.props.onClick}>{this.props.children}</button>
</>
);
}
}

const GlobalStyle = createGlobalStyle`
.fd-add-button {
outline: none;
border-radius: 2px;
white-space: nowrap;
padding: 5px 10px;
border: 1px solid #c60;
color: #ffeadb;
background-color: #c60;
cursor: pointer;
transition: all .2s;
font-family: 'ProximaNovaRegular', sans-serif;
&.persoonlijk {
color: #ffffff;
}
}
`;
export {GlobalStyle as AddButtonStyle};
10 changes: 7 additions & 3 deletions src/Buttons.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import AddButton, {AddButtonStyle} from './AddButton';
import ButtonCallToAction, {ButtonCallToActionStyles} from './ButtonCta';
import ButtonEditorial, { ButtonEditorialStyles } from './ButtonEditorial';
import FollowButton, { FollowButtonStyle } from './FollowButton';

export {ButtonCallToAction, ButtonCallToActionStyles};
export {ButtonEditorial, ButtonEditorialStyles};
export {FollowButton, FollowButtonStyle};
export {
AddButton, AddButtonStyle,
ButtonCallToAction, ButtonCallToActionStyles,
ButtonEditorial, ButtonEditorialStyles,
FollowButton, FollowButtonStyle
};
2 changes: 0 additions & 2 deletions src/FollowButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ const GlobalStyle = createGlobalStyle`
}
}
}
}
`;

export {GlobalStyle as FollowButtonStyle};

0 comments on commit ce0a7b9

Please sign in to comment.