web: Common: Refactoring: Changed component according to accepted requirements
This commit is contained in:
parent
7caff56dbb
commit
a771f0d7cc
31
web/ASC.Web.Common/src/components/Headline/Headline.js
Normal file
31
web/ASC.Web.Common/src/components/Headline/Headline.js
Normal file
@ -0,0 +1,31 @@
|
||||
import React from "react";
|
||||
import PropTypes from 'prop-types';
|
||||
import StyledHeading from "./StyledHeadline";
|
||||
|
||||
const Headline = (props) => {
|
||||
//console.log("Headline render");
|
||||
return (
|
||||
<StyledHeading
|
||||
{...props} />
|
||||
);
|
||||
};
|
||||
|
||||
Headline.propTypes = {
|
||||
level: PropTypes.oneOf([1, 2, 3, 4, 5, 6]),
|
||||
children: PropTypes.any,
|
||||
color: PropTypes.string,
|
||||
title: PropTypes.string,
|
||||
truncate: PropTypes.bool,
|
||||
isInline: PropTypes.bool,
|
||||
type: PropTypes.oneOf(['menu', 'content']),
|
||||
};
|
||||
|
||||
Headline.defaultProps = {
|
||||
color: '#333333',
|
||||
title: '',
|
||||
truncate: false,
|
||||
isInline: false,
|
||||
level: 1
|
||||
};
|
||||
|
||||
export default Headline;
|
18
web/ASC.Web.Common/src/components/Headline/StyledHeadline.js
Normal file
18
web/ASC.Web.Common/src/components/Headline/StyledHeadline.js
Normal file
@ -0,0 +1,18 @@
|
||||
import styled, { css } from 'styled-components';
|
||||
import { Heading } from 'asc-web-components';
|
||||
|
||||
const fontSize = css`
|
||||
${props =>
|
||||
(props.type === 'menu' && 27) ||
|
||||
(props.type === 'content' && 21)
|
||||
}
|
||||
`;
|
||||
|
||||
const StyledHeading = styled(Heading)`
|
||||
margin: 0;
|
||||
line-height: 56px;
|
||||
font-size: ${fontSize}px;
|
||||
font-weight: 700;
|
||||
`;
|
||||
|
||||
export default StyledHeading;
|
@ -1,46 +1 @@
|
||||
import React from "react";
|
||||
import PropTypes from 'prop-types';
|
||||
import styled, { css } from 'styled-components';
|
||||
import { Heading } from 'asc-web-components';
|
||||
|
||||
const fontSize = css`
|
||||
${props =>
|
||||
(props.type === 'menu' && 27) ||
|
||||
(props.type === 'content' && 21)
|
||||
}
|
||||
`;
|
||||
|
||||
const StyledHeading = styled(Heading)`
|
||||
margin: 0;
|
||||
line-height: 56px;
|
||||
font-size: ${fontSize}px;
|
||||
font-weight: 700;
|
||||
`;
|
||||
|
||||
const Headline = (props) => {
|
||||
//console.log("Headline render");
|
||||
return (
|
||||
<StyledHeading
|
||||
{...props} />
|
||||
);
|
||||
};
|
||||
|
||||
Headline.propTypes = {
|
||||
level: PropTypes.oneOf([1, 2, 3, 4, 5, 6]),
|
||||
children: PropTypes.any,
|
||||
color: PropTypes.string,
|
||||
title: PropTypes.string,
|
||||
truncate: PropTypes.bool,
|
||||
isInline: PropTypes.bool,
|
||||
type: PropTypes.oneOf(['menu', 'content']),
|
||||
};
|
||||
|
||||
Headline.defaultProps = {
|
||||
color: '#333333',
|
||||
title: '',
|
||||
truncate: false,
|
||||
isInline: false,
|
||||
level: 1
|
||||
};
|
||||
|
||||
export default Headline;
|
||||
export default from "./Headline";
|
Loading…
Reference in New Issue
Block a user