Skip to content
This repository has been archived by the owner on Apr 16, 2021. It is now read-only.

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
nghiepdev committed Sep 15, 2017
1 parent 2434fd1 commit e7dba6d
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 39 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ import todos from './todos';

export default combineReducers({
todos,
modal: modal({/* default initial state, see below in API */})
modal: modal({
classContent: 'modal-content',
animation: 'zoomIn',
duration: 200,
mask: true,
/* default initial state, see below in API */
})
});
```

Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "react-redux-modal-flex",
"version": "0.1.9",
"description": "Accessible modal dialog component for React Redux, Easy to install and use with Redux",
"version": "0.1.10",
"description":
"Accessible modal dialog component for React Redux, Easy to install and use with Redux",
"keywords": [
"react",
"redux",
Expand Down Expand Up @@ -77,9 +78,11 @@
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js --env=jsdom",
"lib": "cross-env NODE_ENV=production ./node_modules/.bin/webpack --config config/webpack.lib.config.js --progress --profile",
"lib":
"cross-env NODE_ENV=production ./node_modules/.bin/webpack --config config/webpack.lib.config.js --progress --profile",
"prepare": "npm run lib",
"surge": "npm run build && cp build/index.html build/200.html && surge build --domain react-redux-modal-flex.surge.sh"
"surge":
"npm run build && cp build/index.html build/200.html && surge build --domain react-redux-modal-flex.surge.sh"
},
"jest": {
"collectCoverageFrom": ["src/**/*.{js,jsx}"],
Expand Down
6 changes: 1 addition & 5 deletions src/components/ModalSample/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ class ModalSample extends React.Component {
};

render() {
return (
<div style={this.state.style}>
{this.props.content}
</div>
);
return <div style={this.state.style}>{this.props.content}</div>;
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/package/Modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ class Modal extends React.Component {
{...this.props}
>
{show &&
is(Function, Component) &&
is(Function, Component) && (
<Component
toggleModal={toggleModal}
modifyOkModal={modifyOkModal}
/>}
/>
)}
</Content>
</Wrapper>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Wrapper = styled.span`
cursor: pointer;
padding: 8px 12px;
text-transform: uppercase;
transition: all .2s;
transition: all 0.2s;
&:hover {
background: #f2fbff;
color: #6d7379;
Expand All @@ -23,13 +23,14 @@ const Wrapper = styled.span`
}
`;

const Button = ({ children, isDisabled, onClick, primary, className }) =>
const Button = ({ children, isDisabled, onClick, primary, className }) => (
<Wrapper
className={cls(className, { isDisabled, primary })}
onClick={onClick}
>
{children}
</Wrapper>;
</Wrapper>
);

Button.propTypes = {
children: PropTypes.node.isRequired,
Expand Down
17 changes: 9 additions & 8 deletions src/package/components/Content/components/Footer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,23 @@ const Footer = ({
toggleModal,
disabledOk,
actionOk,
}) =>
}) => (
<Wrapper>
{textCancel &&
<Button onClick={() => toggleModal(false)}>
{textCancel}
</Button>}
{textOk &&
{textCancel && (
<Button onClick={() => toggleModal(false)}>{textCancel}</Button>
)}
{textOk && (
<Button
primary
isDisabled={disabledOk}
onClick={() => actionOk()}
className={classOk}
>
{textOk}
</Button>}
</Wrapper>;
</Button>
)}
</Wrapper>
);

Footer.propTypes = {
textOk: PropTypes.string.isRequired,
Expand Down
11 changes: 5 additions & 6 deletions src/package/components/Content/components/Header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const Close = styled.span`
margin-top: -1px;
background: #999;
border-radius: 100%;
transition: background .2s;
transition: background 0.2s;
}
&:before {
transform: rotate(45deg);
Expand All @@ -47,13 +47,12 @@ const Close = styled.span`
}
`;

const Header = ({ title, toggleModal, closeBtn }) =>
const Header = ({ title, toggleModal, closeBtn }) => (
<Wrapper>
<span>
{title}
</span>
<span>{title}</span>
{closeBtn && <Close onClick={() => toggleModal(false)} />}
</Wrapper>;
</Wrapper>
);

Header.propTypes = {
title: PropTypes.string.isRequired,
Expand Down
5 changes: 1 addition & 4 deletions src/package/components/Content/components/Main/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ const Wrapper = styled.section`
}
`;

const Main = ({ children }) =>
<Wrapper>
{children}
</Wrapper>;
const Main = ({ children }) => <Wrapper>{children}</Wrapper>;

Main.propTypes = {
children: PropTypes.node,
Expand Down
10 changes: 4 additions & 6 deletions src/package/components/Content/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ const Wrapper = styled.section`
justify-content: center;
align-items: center;
background: ${props => (props.mask ? 'rgba(0, 0, 0, 0.5)' : 'transparent')};
animation-duration: .2s;
animation-duration: 0.2s;
& > div.animated {
display: flex;
flex-direction: column;
min-width: 320px;
min-height: 200px;
max-width: 90vw;
max-width: 95vw;
max-height: 80vh;
background: #fff;
border-radius: 2px;
border: 1px solid #ebebee;
box-shadow: 0 2px 8px rgba(0, 0, 0, .33);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.33);
animation-duration: ${props => props.duration}ms;
}
`;
Expand Down Expand Up @@ -61,9 +61,7 @@ class Content extends React.Component {
>
<div className={className}>
<Header {...this.props} />
<Main>
{children}
</Main>
<Main>{children}</Main>
{isFooter && <Footer {...this.props} />}
</div>
</Wrapper>
Expand Down

0 comments on commit e7dba6d

Please sign in to comment.