mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 19:04:38 +00:00
Remove _deprecated folder and add test to components/Button
This commit is contained in:
parent
14933b38b9
commit
971e33e4b6
@ -1,10 +1,10 @@
|
||||
// import OldList from '../index';
|
||||
// import Button from '../index';
|
||||
|
||||
import expect from 'expect';
|
||||
// import { shallow } from 'enzyme';
|
||||
// import React from 'react';
|
||||
|
||||
describe('<OldList />', () => {
|
||||
describe('<Button />', () => {
|
||||
it('Expect to have unit tests specified', () => {
|
||||
expect(true).toEqual(false);
|
||||
});
|
||||
@ -1,128 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* OldList
|
||||
* params:
|
||||
* -handlei18n: bool
|
||||
* used for the buttonComponent to render label with FormattedMessage
|
||||
* - listButtonLabel: string
|
||||
* - listTitle: string
|
||||
* - noListButtonPopUp: bool
|
||||
* prevent from displaying the OldList button
|
||||
* - renderRow: function
|
||||
* overrides the default rendering of the OldList tr (we can pass customs components there)
|
||||
* - listItems: array the elements to display
|
||||
* - handleListPopButtonSave: func
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { map } from 'lodash';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
|
||||
import ButtonPrimaryHotline from 'components/Button';
|
||||
import PopUpForm from 'components/PopUpForm';
|
||||
import styles from './styles.scss';
|
||||
|
||||
class OldList extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
modal: false,
|
||||
};
|
||||
}
|
||||
|
||||
toggle = () => {
|
||||
this.setState({ modal: !this.state.modal });
|
||||
}
|
||||
|
||||
handleSubmit = () => {
|
||||
this.setState({ modal: !this.state.modal });
|
||||
this.props.handleListPopUpSubmit();
|
||||
}
|
||||
|
||||
render() {
|
||||
const button = this.props.noListButtonPopUp ? '' :
|
||||
<ButtonPrimaryHotline
|
||||
buttonBackground={'secondaryAddType'}
|
||||
label={this.props.listButtonLabel}
|
||||
handlei18n={this.props.handlei18n}
|
||||
addShape
|
||||
onClick={this.toggle}
|
||||
/>;
|
||||
|
||||
return (
|
||||
<div className={styles.listContainer}>
|
||||
<div className={styles.listComponent}>
|
||||
<div className="container-fluid">
|
||||
<div className="row">
|
||||
<div className={styles.flex}>
|
||||
<div className={styles.titleContainer}>
|
||||
{this.props.listTitle}
|
||||
</div>
|
||||
<div>
|
||||
{button}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="row">
|
||||
<div className="col-md-12">
|
||||
<table className={` table ${styles.listNoBorder}`}>
|
||||
<tbody>
|
||||
{map(this.props.listItems, (value, key) => {
|
||||
// handle custom row displaying
|
||||
if (this.props.renderRow) {
|
||||
return this.props.renderRow(value, key, styles);
|
||||
}
|
||||
return (
|
||||
<tr key={key}>
|
||||
<th>{key}</th>
|
||||
<td>{value.name}</td>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Modal isOpen={this.state.modal} toggle={this.toggle}>
|
||||
<ModalHeader toggle={this.toggle} className={`${styles.noBorder}`}>
|
||||
<FormattedMessage {...{id: this.props.listButtonLabel}} />
|
||||
</ModalHeader>
|
||||
<div className={styles.bordered} />
|
||||
<ModalBody>
|
||||
<PopUpForm {...this.props} />
|
||||
</ModalBody>
|
||||
<ModalFooter className={`${styles.noBorder} ${styles.flexStart}`}>
|
||||
{/* TODO change tthis.toggle => this.props.addLanguage */}
|
||||
<Button onClick={this.handleSubmit} className={styles.primary}>Save</Button>{' '}
|
||||
<Button onClick={this.toggle} className={styles.secondary}>Cancel</Button>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
OldList.propTypes = {
|
||||
handlei18n: React.PropTypes.bool,
|
||||
handleListPopUpSubmit: React.PropTypes.func,
|
||||
listButtonLabel: React.PropTypes.string,
|
||||
listItems: React.PropTypes.array,
|
||||
listTitle: React.PropTypes.oneOfType([
|
||||
React.PropTypes.string,
|
||||
React.PropTypes.object,
|
||||
]),
|
||||
noListButtonPopUp: React.PropTypes.bool,
|
||||
renderRow: React.PropTypes.oneOfType([
|
||||
React.PropTypes.bool,
|
||||
React.PropTypes.func,
|
||||
]),
|
||||
};
|
||||
|
||||
export default OldList;
|
||||
@ -1,88 +0,0 @@
|
||||
.listComponent { /* stylelint-disable */
|
||||
margin: 0 3.3rem;
|
||||
padding: 2rem 2.8rem 5.8rem 2.8rem;
|
||||
border-radius: 0.2rem;
|
||||
background-color: #FFFFFF;
|
||||
box-shadow: 0 0.2rem 0.4rem 0 #E3E9F3;
|
||||
}
|
||||
|
||||
.listContainer {
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
.flex {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 0.8rem;
|
||||
margin-bottom: 2.5rem;
|
||||
}
|
||||
|
||||
.titleContainer {
|
||||
color: #333740;
|
||||
font-family: Lato;
|
||||
font-size: 1.8rem;
|
||||
font-weight: bold;
|
||||
line-height: 2.2rem;
|
||||
}
|
||||
|
||||
.listNoBorder {
|
||||
> tbody {
|
||||
tr {
|
||||
height: 5.4rem;
|
||||
font-size: 1.3rem;
|
||||
line-height: 1.6rem;
|
||||
font-family: Lato;
|
||||
&:first-of-type {
|
||||
> td, th {
|
||||
border-top: none !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.primary {
|
||||
background: linear-gradient(315deg, #0097F6 0%, #005EEA 100%);
|
||||
color: white;
|
||||
width: 15rem;
|
||||
}
|
||||
|
||||
.secondary {
|
||||
color: #F64D0A;
|
||||
border: 0.1rem solid #F64D0A;
|
||||
margin-left: 1.9rem!important;
|
||||
}
|
||||
|
||||
.bordered {
|
||||
margin-left: 3rem;
|
||||
margin-right: 3rem;
|
||||
border: 1px solid #F6F6F6;
|
||||
}
|
||||
|
||||
.noBorder {
|
||||
border: none!important;
|
||||
}
|
||||
|
||||
.flexStart {
|
||||
justify-content: flex-start!important;
|
||||
}
|
||||
|
||||
.italicText {
|
||||
color: #49515A;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.normal {
|
||||
color: #1C5DE7;
|
||||
padding-top: 0rem;
|
||||
}
|
||||
|
||||
.lighter {
|
||||
color: #333740;
|
||||
}
|
||||
|
||||
.label {
|
||||
color: #333740;
|
||||
font-weight: 600;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
17475
packages/strapi-plugin-settings-manager/package-lock.json
generated
Normal file
17475
packages/strapi-plugin-settings-manager/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -65,4 +65,4 @@
|
||||
"npm": ">= 3.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user