Skip to content

Commit

Permalink
added: styled-components; prop-types; Avatar
Browse files Browse the repository at this point in the history
  • Loading branch information
vedees committed Mar 14, 2022
1 parent 5b3d9ad commit 678239a
Show file tree
Hide file tree
Showing 11 changed files with 8,118 additions and 8,094 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
"pdf-builder"
],
"devDependencies": {
"node-sass": "^7.0.1",
"react-scripts": "5.0.0",
"node-sass": "^7.0.1"
"styled-components": "^5.3.3"
},
"dependencies": {
"prop-types": "^15.8.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"uimini": "^2.0.7"
Expand Down
8 changes: 6 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import React from 'react'

import { Header, Footer } from './components'
import { Header, Footer, Avatar } from './components'

const App = () => {
const handleAvatarClick = () => console.log('avatar clicked')
const handlePrintClick = () => console.log('print button clicked')

return (
<div className='ui-wrapper'>
<Header />
<Header onClick={handlePrintClick} />
<div className='ui-content-wrapper'>
<section className='ui-section'>
<div className='ui-container'>
<Avatar onClick={handleAvatarClick} />
<h1 className='ui-title-1'>Hello world!</h1>
</div>
</section>
Expand Down
8 changes: 6 additions & 2 deletions src/components/Footer/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ import './Footer.scss'

const Footer = () => {
return (
<footer>
<div className='ui-container'>footer</div>
<footer className='Footer'>
<div className='ui-container'>
<a className='ui-link' href='#' target='_blank'>
Github
</a>
</div>
</footer>
)
}
Expand Down
4 changes: 4 additions & 0 deletions src/components/Footer/Footer.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.Footer {
margin-top: 1rem;
text-align: center;
}
22 changes: 19 additions & 3 deletions src/components/Header/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
import React from 'react'
import propTypes from 'prop-types'

import './Header.scss'

const Header = () => {
const Header = ({ onClick }) => {
return (
<header>
<div className='ui-container'>header</div>
<header className='Header'>
<div className='ui-container'>
<div className='Header_content'>
<span className='Header_logo'>Cv builder</span>
<button className='ui-button isLink' onClick={onClick}>
Print
</button>
</div>
</div>
</header>
)
}

Header.propTypes = {
onClick: propTypes.func,
}

Header.defaultProps = {
onClick: () => {},
}

export default Header
15 changes: 13 additions & 2 deletions src/components/Header/Header.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
header {
background-color: red;
.Header {
padding: 1rem 0;
margin-bottom: 1rem;
}

.Header_content {
display: flex;
align-items: center;
justify-content: space-between;
}

.Header_logo {
font-weight: 700;
}
Empty file added src/components/UI/.gitkeep
Empty file.
22 changes: 22 additions & 0 deletions src/components/UI/Avatar/Avatar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import styled from 'styled-components'
import propTypes from 'prop-types'

const Avatar = styled.div`
width: 10rem;
height: 10rem;
margin-right: 4rem;
border-radius: ${(props) => (props.isSquare ? '10px' : '50%')};
background-color: #bfbfbf;
`

Avatar.propTypes = {
isSquare: propTypes.bool,
onClick: propTypes.func,
}

Avatar.defaultProps = {
isSquare: false,
onClick: () => {},
}

export default Avatar
3 changes: 3 additions & 0 deletions src/components/UI/Avatar/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Avatar from './Avatar'

export default Avatar
3 changes: 3 additions & 0 deletions src/components/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// components:
export { default as Header } from './Header'
export { default as Footer } from './Footer'

// UI components:
export { default as Avatar } from './UI/Avatar'
Loading

0 comments on commit 678239a

Please sign in to comment.