mirror of
https://github.com/strapi/strapi.git
synced 2025-11-08 14:19:40 +00:00
PR review
This commit is contained in:
parent
30b9eb0650
commit
cce49dc4b8
@ -1,3 +1,7 @@
|
|||||||
|
// // Assets
|
||||||
|
export { default as colors } from './assets/styles/colors';
|
||||||
|
export { default as sizes } from './assets/styles/sizes';
|
||||||
|
|
||||||
// // CommonPropTypes
|
// // CommonPropTypes
|
||||||
export { default as routerPropTypes } from './commonPropTypes/router';
|
export { default as routerPropTypes } from './commonPropTypes/router';
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +0,0 @@
|
|||||||
const colors = {
|
|
||||||
beige: '#eff3f6',
|
|
||||||
black: '#3b3b3b',
|
|
||||||
brightGrey: '#f0f3f8',
|
|
||||||
green: '#27b70f',
|
|
||||||
greyOpacity: 'rgba(14, 22, 34, 0.02)',
|
|
||||||
lightGrey: '#fafafa',
|
|
||||||
};
|
|
||||||
|
|
||||||
export default colors;
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
const sizes = {
|
|
||||||
header: {
|
|
||||||
height: '6rem',
|
|
||||||
},
|
|
||||||
margin: 10,
|
|
||||||
modal: {
|
|
||||||
footer: {
|
|
||||||
height: '6rem',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default sizes;
|
|
||||||
@ -7,21 +7,17 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import { Button } from 'reactstrap';
|
|
||||||
|
|
||||||
import styles from './styles.scss';
|
import StyledButtonModalPrimary from './StyledButtonModalPrimary';
|
||||||
|
|
||||||
function ButtonModalPrimary({ add, message, onClick, type }) {
|
function ButtonModalPrimary({ add, message, onClick, type }) {
|
||||||
/* istanbul ignore next */
|
const icon = add ? <i className={`fa fa-plus`} /> : null;
|
||||||
// Ignoring the style condition is intended...
|
|
||||||
const className = add
|
|
||||||
? styles.buttonModalPrimaryAdd
|
|
||||||
: styles.buttonModalPrimary;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button className={className} onClick={onClick} type={type}>
|
<StyledButtonModalPrimary onClick={onClick} type={type}>
|
||||||
|
{icon}
|
||||||
<FormattedMessage id={message} />
|
<FormattedMessage id={message} />
|
||||||
</Button>
|
</StyledButtonModalPrimary>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,32 +0,0 @@
|
|||||||
.buttonModalPrimary,
|
|
||||||
.buttonModalPrimaryAdd {
|
|
||||||
height: 3rem;
|
|
||||||
min-width: 11rem;
|
|
||||||
background: linear-gradient(315deg, #0097f6 0%, #005eea 100%);
|
|
||||||
padding: 0 15px;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
cursor: pointer;
|
|
||||||
border-radius: 3px;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
font-family: Lato;
|
|
||||||
font-weight: 600;
|
|
||||||
outline: 0;
|
|
||||||
&:hover,
|
|
||||||
&:active {
|
|
||||||
border: none;
|
|
||||||
background: linear-gradient(315deg, #0097f6 0%, #005eea 100%);
|
|
||||||
box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.15);
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.buttonModalPrimaryAdd {
|
|
||||||
&:before {
|
|
||||||
content: '\F067';
|
|
||||||
font-family: 'FontAwesome';
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 1.3rem;
|
|
||||||
margin-right: 13px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,25 +1,20 @@
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* ButtonModalSecondary
|
* ButtonModalSecondary
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import { Button } from 'reactstrap';
|
|
||||||
|
|
||||||
import styles from './styles.scss';
|
import StyledButtonModalSecondary from './StyledButtonModalSecondary';
|
||||||
|
|
||||||
function ButtonModalSecondary({ message, onClick, type }) {
|
function ButtonModalSecondary({ message, onClick, type }) {
|
||||||
return (
|
return (
|
||||||
<Button
|
<StyledButtonModalSecondary onClick={onClick} type={type}>
|
||||||
className={styles.buttonModalSecondary}
|
|
||||||
onClick={onClick}
|
|
||||||
type={type}
|
|
||||||
>
|
|
||||||
<FormattedMessage id={message} />
|
<FormattedMessage id={message} />
|
||||||
</Button>
|
</StyledButtonModalSecondary>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,11 @@ import ButtonModalSecondary from '../index';
|
|||||||
|
|
||||||
describe('<ButtonModalSecondary />', () => {
|
describe('<ButtonModalSecondary />', () => {
|
||||||
it('should not crash', () => {
|
it('should not crash', () => {
|
||||||
shallow(<ButtonModalSecondary onClick={jest.fn()} message="" />);
|
shallow(
|
||||||
|
<ButtonModalSecondary
|
||||||
|
onClick={jest.fn()}
|
||||||
|
message="app.utils.defaultMessage"
|
||||||
|
/>
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -2,7 +2,8 @@ import styled from 'styled-components';
|
|||||||
import { Button } from 'reactstrap';
|
import { Button } from 'reactstrap';
|
||||||
|
|
||||||
import img from '../../assets/icons/icon_check.png';
|
import img from '../../assets/icons/icon_check.png';
|
||||||
import colors from '../../assets/styles/colors';
|
|
||||||
|
import { colors } from 'strapi-helper-plugin';
|
||||||
|
|
||||||
const StyledButtonModalSuccess = styled(Button)`
|
const StyledButtonModalSuccess = styled(Button)`
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@ -6,8 +6,7 @@
|
|||||||
|
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import colors from '../../assets/styles/colors';
|
import { colors, sizes } from 'strapi-helper-plugin';
|
||||||
import sizes from '../../assets/styles/sizes';
|
|
||||||
|
|
||||||
const FooterModal = styled.div`
|
const FooterModal = styled.div`
|
||||||
padding-top: ${sizes.margin * 0.9}px;
|
padding-top: ${sizes.margin * 0.9}px;
|
||||||
|
|||||||
@ -6,8 +6,7 @@
|
|||||||
|
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import colors from '../../assets/styles/colors';
|
import { colors, sizes } from 'strapi-helper-plugin';
|
||||||
import sizes from '../../assets/styles/sizes';
|
|
||||||
|
|
||||||
const HeaderModal = styled.div`
|
const HeaderModal = styled.div`
|
||||||
color: ${colors.black};
|
color: ${colors.black};
|
||||||
|
|||||||
@ -246,7 +246,7 @@ describe('Content Type Builder Action utils', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('BuildGroupAttributes', () => {
|
describe('BuildGroupAttributes', () => {
|
||||||
it('should generate an array of object with an object', () => {
|
it('should generate an array of attribute objects given an object', () => {
|
||||||
const attributes = {
|
const attributes = {
|
||||||
name: {
|
name: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
|||||||
@ -6,20 +6,12 @@
|
|||||||
|
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import sizes from '../../assets/styles/sizes';
|
import { colors, sizes } from 'strapi-helper-plugin';
|
||||||
|
|
||||||
// Specific colors for left menu
|
|
||||||
const colors = {
|
|
||||||
black: '#2D3138',
|
|
||||||
grey: '#666B74',
|
|
||||||
mediumGrey: '#f2f3f4',
|
|
||||||
lightGrey: '#E9EAEB',
|
|
||||||
};
|
|
||||||
|
|
||||||
const StyledLeftMenu = styled.div`
|
const StyledLeftMenu = styled.div`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: calc(100vh - ${sizes.header.height});
|
min-height: calc(100vh - ${sizes.header.height});
|
||||||
background-color: ${colors.mediumGrey};
|
background-color: ${colors.leftMenu.mediumGrey};
|
||||||
padding-top: 0.5rem;
|
padding-top: 0.5rem;
|
||||||
padding-left: 2rem;
|
padding-left: 2rem;
|
||||||
padding-right: 2rem;
|
padding-right: 2rem;
|
||||||
@ -79,7 +71,7 @@ const StyledLeftMenu = styled.div`
|
|||||||
display: block;
|
display: block;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
p {
|
p {
|
||||||
color: ${colors.black};
|
color: ${colors.leftMenu.black};
|
||||||
}
|
}
|
||||||
i {
|
i {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
@ -87,10 +79,10 @@ const StyledLeftMenu = styled.div`
|
|||||||
color: ${colors.grey};
|
color: ${colors.grey};
|
||||||
}
|
}
|
||||||
&.active {
|
&.active {
|
||||||
background-color: ${colors.lightGrey};
|
background-color: ${colors.leftMenu.lightGrey};
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
i {
|
i {
|
||||||
color: ${colors.black};
|
color: ${colors.leftMenu.black};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { shallow } from 'enzyme';
|
||||||
import formatMessagesWithPluginId from 'testUtils/formatMessages';
|
import formatMessagesWithPluginId from 'testUtils/formatMessages';
|
||||||
import pluginTradsEn from '../../../translations/en.json';
|
import pluginTradsEn from '../../../translations/en.json';
|
||||||
import { BrowserRouter } from 'react-router-dom';
|
import { BrowserRouter } from 'react-router-dom';
|
||||||
@ -119,17 +120,25 @@ describe('CTB <LeftMenu />', () => {
|
|||||||
it('Should not crash', () => {
|
it('Should not crash', () => {
|
||||||
renderCompo(context);
|
renderCompo(context);
|
||||||
});
|
});
|
||||||
|
describe('<LeftMenu /> lifecycle', () => {
|
||||||
|
let topCompo;
|
||||||
|
afterEach(() => {
|
||||||
|
topCompo.unmount();
|
||||||
|
});
|
||||||
|
|
||||||
describe('CTB <ModelPage /> render', () => {
|
describe('Render links', () => {
|
||||||
it('should render 5 links in the menu', () => {
|
it('should render 5 links in the menu', () => {
|
||||||
const wrapper = renderComponent();
|
topCompo = renderComponent();
|
||||||
const links = wrapper.find(LeftMenuLink);
|
const links = topCompo.find(LeftMenuLink);
|
||||||
|
|
||||||
expect(links).toHaveLength(5);
|
expect(links).toHaveLength(5);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a plural string for the user', () => {
|
describe('Retrieve section title', () => {
|
||||||
expect(getSectionTitle('model', [])).toContain('singular');
|
it('should return a plural string for the user', () => {
|
||||||
|
expect(getSectionTitle('model', [])).toContain('singular');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -6,8 +6,7 @@
|
|||||||
|
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import colors from '../../assets/styles/colors';
|
import { colors, sizes } from 'strapi-helper-plugin';
|
||||||
import sizes from '../../assets/styles/sizes';
|
|
||||||
|
|
||||||
const StyledViewContainer = styled.div`
|
const StyledViewContainer = styled.div`
|
||||||
min-height: calc(100vh - ${sizes.header.height});
|
min-height: calc(100vh - ${sizes.header.height});
|
||||||
|
|||||||
@ -10,7 +10,6 @@ const renderCompo = (props = {}) => {
|
|||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
children: null,
|
children: null,
|
||||||
featureType: 'group',
|
featureType: 'group',
|
||||||
handleClickIcon: jest.fn(),
|
|
||||||
headerTitle: 'Ingredients',
|
headerTitle: 'Ingredients',
|
||||||
headerDescription: 'description',
|
headerDescription: 'description',
|
||||||
match: {
|
match: {
|
||||||
@ -18,6 +17,7 @@ const defaultProps = {
|
|||||||
groupName: 'ingredients',
|
groupName: 'ingredients',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
onClickIcon: jest.fn(),
|
||||||
pluginHeaderActions: [],
|
pluginHeaderActions: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user