diff --git a/package.json b/package.json index 61d2644..a03dc61 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "styled-components": "^5.3.3" }, "dependencies": { + "classnames": "^2.3.1", "prop-types": "^15.8.1", "react": "^17.0.2", "react-dom": "^17.0.2", diff --git a/src/App.js b/src/App.js index 8362110..227e183 100644 --- a/src/App.js +++ b/src/App.js @@ -1,6 +1,35 @@ import React from 'react' +import styled from 'styled-components' -import { Header, Footer, Avatar } from './components' +// components: +import { Header, Footer, Avatar, Title, Descr } from './components' + +const Wrapper = styled.div` + max-width: 1200px; + margin: 2rem auto; + padding: 3rem 2rem; + background-color: white; + border: 1px solid #ececec; + box-shadow: 5px 7px 10px 4px #ececec; + border-radius: 14px; +` + +const Row = styled.section` + display: flex; + flex-wrap: wrap; + align-items: ${(props) => (props.itemsCenter ? 'center' : 'start')}; + margin: 2rem 0; +` + +const Sidebar = styled.div` + flex: 1; + margin-right: 1rem; +` + +const Content = styled.div` + flex: 3; + margin-left: 1rem; +` const App = () => { const handleAvatarClick = () => console.log('avatar clicked') @@ -10,12 +39,51 @@ const App = () => {
+ {children} +
+ ) +} + +Descr.propTypes = { + isPrimary: propTypes.bool, + isSecondary: propTypes.bool, + className: propTypes.string, + children: propTypes.node.isRequired, +} + +Descr.defaultProps = { + isPrimary: false, + isSecondary: false, + className: '', +} + +export default Descr diff --git a/src/components/UI/Descr/index.js b/src/components/UI/Descr/index.js new file mode 100644 index 0000000..62a0d31 --- /dev/null +++ b/src/components/UI/Descr/index.js @@ -0,0 +1,3 @@ +import Descr from './Descr' + +export default Descr diff --git a/src/components/UI/Title/Title.jsx b/src/components/UI/Title/Title.jsx new file mode 100644 index 0000000..33f9ce8 --- /dev/null +++ b/src/components/UI/Title/Title.jsx @@ -0,0 +1,34 @@ +import React from 'react' +import classNames from 'classnames' +import propTypes from 'prop-types' + +const Title = ({ size, isUppercase, className, children, ...attrs }) => { + const classes = classNames(`ui-title-${size}`, className, { isUppercase }) + + return ( ++ {children} +
+ ) +} + +Title.propTypes = { + size: propTypes.oneOf(['1', '2', '3']), + isUppercase: propTypes.bool, + className: propTypes.string, + children: propTypes.node.isRequired, +} + +Title.defaultProps = { + size: '1', + isUppercase: false, + className: '', +} + +export default Title diff --git a/src/components/UI/Title/index.js b/src/components/UI/Title/index.js new file mode 100644 index 0000000..41712f2 --- /dev/null +++ b/src/components/UI/Title/index.js @@ -0,0 +1,3 @@ +import Title from './Title' + +export default Title diff --git a/src/components/index.js b/src/components/index.js index 07e166a..91c1b56 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -4,3 +4,7 @@ export { default as Footer } from './Footer' // UI components: export { default as Avatar } from './UI/Avatar' + +// layouts: +export { default as Title } from './UI/Title' +export { default as Descr } from './UI/Descr' diff --git a/yarn.lock b/yarn.lock index 866bc66..85751d0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2942,6 +2942,11 @@ cjs-module-lexer@^1.0.0: resolved "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz" integrity sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA== +classnames@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.1.tgz#dfcfa3891e306ec1dad105d0e88f4417b8535e8e" + integrity sha512-OlQdbZ7gLfGarSqxesMesDa5uz7KFbID8Kpq/SxIoNGDqY8lSYs0D+hhtBXhcdB3rcbXArFr7vlHheLk1voeNA== + clean-css@^5.2.2: version "5.2.4" resolved "https://registry.npmjs.org/clean-css/-/clean-css-5.2.4.tgz"