-
-
Notifications
You must be signed in to change notification settings - Fork 76
React-styling Done #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
c6b356d
7ef1b68
3700ab5
7274f24
d83d188
0324460
87da206
2bd4183
75901b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,26 @@ | ||
| import React from 'react'; | ||
|
|
||
| import Alert from './../src/components/Alert'; | ||
| import { ThemeProvider } from 'styled-components'; | ||
| import { Row, Col, Alert as RBAlert } from 'react-bootstrap'; | ||
| import theme from '../src/components/theme'; | ||
| import Alert from './../src/components/Alert'; | ||
|
|
||
| const Task01 = () => { | ||
| return ( | ||
| <Row> | ||
| <Col> | ||
| <RBAlert variant="primary">Uwaga! <em>Styled Components</em> nadchodzi!</RBAlert> | ||
| </Col> | ||
| <Col> | ||
| <Alert>Uwaga! <em>Styled Components</em> nadchodzi!</Alert> | ||
| </Col> | ||
| </Row> | ||
| ) | ||
| } | ||
| return ( | ||
| <Row> | ||
| <Col> | ||
| <RBAlert variant="primary"> | ||
| Uwaga! <em>Styled Components</em> nadchodzi! | ||
| </RBAlert> | ||
| </Col> | ||
| <Col> | ||
| <ThemeProvider theme={theme}> | ||
| <Alert variant="secondary"> | ||
| Uwaga! <em>Styled Components</em> nadchodzi! | ||
| </Alert> | ||
| </ThemeProvider> | ||
| </Col> | ||
| </Row> | ||
| ); | ||
| }; | ||
|
|
||
| export default Task01; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,26 @@ | ||
| import React from 'react'; | ||
|
|
||
| import Button from './../src/components/Button'; | ||
| import { ThemeProvider } from 'styled-components'; | ||
| import theme from '../src/components/theme'; | ||
| import Button from '../src/components/Button/Button'; | ||
| import { Row, Col, Button as RBButton } from 'react-bootstrap'; | ||
|
|
||
| const Task02 = () => { | ||
| return ( | ||
| <Row> | ||
| <Col> | ||
| <RBButton variant="primary" size="lg">Button!</RBButton> | ||
| </Col> | ||
| <Col> | ||
| Button! | ||
| </Col> | ||
| </Row> | ||
| ) | ||
| } | ||
| return ( | ||
| <Row> | ||
| <Col> | ||
| <RBButton variant="primary" size="lg"> | ||
| Button! | ||
| </RBButton> | ||
| </Col> | ||
| <Col> | ||
| <ThemeProvider theme={theme}> | ||
| <Button variant="primary" size="large"> | ||
| Button! | ||
| </Button> | ||
| </ThemeProvider> | ||
| </Col> | ||
| </Row> | ||
| ); | ||
| }; | ||
|
|
||
| export default Task02; | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,35 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { ThemeProvider } from 'styled-components'; | ||
| import theme from '../src/components/theme'; | ||
| import { Row, Col, Breadcrumb as RBBreadcrumb } from 'react-bootstrap'; | ||
| import { Breadcrumb, BreadcrumbItem } from '../src/components/Breadcrumb/index'; | ||
|
|
||
| const Task03 = () => { | ||
| return ( | ||
| <Row> | ||
| <Col> | ||
| <RBBreadcrumb> | ||
| <RBBreadcrumb.Item href="#">Home</RBBreadcrumb.Item> | ||
| <RBBreadcrumb.Item href="https://getbootstrap.com/docs/4.0/components/breadcrumb/"> | ||
| Library | ||
| </RBBreadcrumb.Item> | ||
| <RBBreadcrumb.Item active>Data</RBBreadcrumb.Item> | ||
| </RBBreadcrumb> | ||
| </Col> | ||
| <Col> | ||
| Breadcrumb! | ||
| </Col> | ||
| </Row> | ||
| ) | ||
| } | ||
|
|
||
| return ( | ||
| <ThemeProvider theme={theme}> | ||
| <Row> | ||
| <Col> | ||
| <RBBreadcrumb> | ||
| <RBBreadcrumb.Item href="#">Home</RBBreadcrumb.Item> | ||
| <RBBreadcrumb.Item href="https://getbootstrap.com/docs/4.0/components/breadcrumb/"> | ||
| Library | ||
| </RBBreadcrumb.Item> | ||
| <RBBreadcrumb.Item active>Data</RBBreadcrumb.Item> | ||
| </RBBreadcrumb> | ||
| </Col> | ||
| <Col> | ||
| <ThemeProvider theme={theme}> | ||
| <Breadcrumb> | ||
| <BreadcrumbItem href="#">Home</BreadcrumbItem> | ||
| <BreadcrumbItem href="https://getbootstrap.com/docs/4.0/components/breadcrumb/"> | ||
| Library | ||
| </BreadcrumbItem> | ||
| <BreadcrumbItem active>Data</BreadcrumbItem> | ||
| </Breadcrumb> | ||
| </ThemeProvider> | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| </Col> | ||
| </Row> | ||
| </ThemeProvider> | ||
| ); | ||
| }; | ||
| export default Task03; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,70 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { Row, Col, Tabs as RBTabs, Tab as RBTab, } from 'react-bootstrap'; | ||
| import { Row, Col, Tabs as RBTabs, Tab as RBTab } from 'react-bootstrap'; | ||
| import { Tab, Tabs } from '../src/components/Tab/index'; | ||
|
|
||
| const Task04 = () => { | ||
| return ( | ||
| <Row> | ||
| <Col> | ||
| <RBTabs defaultActiveKey="profile" id="uncontrolled-tab-example"> | ||
| <RBTab eventKey="home" title="Home"> | ||
| <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur condimentum lacus nec ligula faucibus rhoncus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; </p> | ||
| </RBTab> | ||
| <RBTab eventKey="profile" title="Profile"> | ||
| <p>Donec dignissim ultricies felis, eu dictum eros congue in. In gravida lobortis libero nec tempus. Cras rutrum nisl ut leo volutpat rhoncus. Nulla massa nulla, viverra hendrerit laoreet at, tincidunt eu lacus.</p> | ||
| </RBTab> | ||
| <RBTab eventKey="contact" title="Contact" disabled> | ||
| <p>Vivamus metus nulla, fermentum eget placerat vitae, mollis interdum elit. Pellentesque arcu augue, vulputate ut porttitor ut, suscipit non orci. Integer justo odio, suscipit eget tortor nec, molestie lobortis eros. Nullam commodo elit sit amet lacus blandit aliquet. Mauris at nibh eget nisl pulvinar dignissim.</p> | ||
| </RBTab> | ||
| </RBTabs> | ||
| </Col> | ||
| <Col> | ||
| Tabs! | ||
| </Col> | ||
| </Row> | ||
| ) | ||
| } | ||
| return ( | ||
| <Row> | ||
| <Col> | ||
| <RBTabs defaultActiveKey="profile" id="uncontrolled-tab-example"> | ||
| <RBTab eventKey="home" title="Home"> | ||
| <p> | ||
| Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur | ||
| condimentum lacus nec ligula faucibus rhoncus. Vestibulum ante | ||
| ipsum primis in faucibus orci luctus et ultrices posuere cubilia | ||
| Curae;{' '} | ||
| </p> | ||
| </RBTab> | ||
| <RBTab eventKey="profile" title="Profile"> | ||
| <p> | ||
| Donec dignissim ultricies felis, eu dictum eros congue in. In | ||
| gravida lobortis libero nec tempus. Cras rutrum nisl ut leo | ||
| volutpat rhoncus. Nulla massa nulla, viverra hendrerit laoreet at, | ||
| tincidunt eu lacus. | ||
| </p> | ||
| </RBTab> | ||
| <RBTab eventKey="contact" title="Contact" disabled> | ||
| <p> | ||
| Vivamus metus nulla, fermentum eget placerat vitae, mollis | ||
| interdum elit. Pellentesque arcu augue, vulputate ut porttitor ut, | ||
| suscipit non orci. Integer justo odio, suscipit eget tortor nec, | ||
| molestie lobortis eros. Nullam commodo elit sit amet lacus blandit | ||
| aliquet. Mauris at nibh eget nisl pulvinar dignissim. | ||
| </p> | ||
| </RBTab> | ||
| </RBTabs> | ||
| </Col> | ||
| <Col> | ||
| <Tabs defaultActiveKey="profile" id="uncontrolled-tab-example"> | ||
| <Tab eventKey="home" title="Home"> | ||
| <p> | ||
| Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur | ||
| condimentum lacus nec ligula faucibus rhoncus. Vestibulum ante | ||
| ipsum primis in faucibus orci luctus et ultrices posuere cubilia | ||
| Curae;{' '} | ||
| </p> | ||
| </Tab> | ||
| <Tab eventKey="profile" title="Profile" active="activeTab"> | ||
| <p> | ||
| Donec dignissim ultricies felis, eu dictum eros congue in. In | ||
| gravida lobortis libero nec tempus. Cras rutrum nisl ut leo | ||
| volutpat rhoncus. Nulla massa nulla, viverra hendrerit laoreet at, | ||
| tincidunt eu lacus. | ||
| </p> | ||
| </Tab> | ||
| <Tab eventKey="contact" title="Contact" disabled={true}> | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| <p> | ||
| Vivamus metus nulla, fermentum eget placerat vitae, mollis | ||
| interdum elit. Pellentesque arcu augue, vulputate ut porttitor ut, | ||
| suscipit non orci. Integer justo odio, suscipit eget tortor nec, | ||
| molestie lobortis eros. Nullam commodo elit sit amet lacus blandit | ||
| aliquet. Mauris at nibh eget nisl pulvinar dignissim. | ||
| </p> | ||
| </Tab> | ||
| </Tabs> | ||
| </Col> | ||
| </Row> | ||
| ); | ||
| }; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
|
||
| export default Task04; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,51 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { ThemeProvider } from 'styled-components'; | ||
| import theme from '../src/components/theme'; | ||
| import { Row, Col, Card as RBCard, Button as RBButton } from 'react-bootstrap'; | ||
| import { | ||
| Card, | ||
| CardImg, | ||
| CardBody, | ||
| CardTitle, | ||
| CardText, | ||
| Button, | ||
| } from '../src/components/Card/index'; | ||
|
|
||
| const Task05 = () => { | ||
| return ( | ||
| <Row> | ||
| <Col> | ||
| <RBCard style={{ width: '18rem' }}> | ||
| <RBCard.Img variant="top" src="https://picsum.photos/100/80" /> | ||
| <RBCard.Body> | ||
| <RBCard.Title>Card Title</RBCard.Title> | ||
| <RBCard.Text> | ||
| Some quick example text to build on the card title and make up the bulk of | ||
| the card's content. | ||
| </RBCard.Text> | ||
| <RBButton variant="primary">Go somewhere</RBButton> | ||
| </RBCard.Body> | ||
| </RBCard> | ||
| </Col> | ||
| <Col> | ||
| Card! | ||
| </Col> | ||
| </Row> | ||
| ) | ||
| } | ||
| return ( | ||
| <Row> | ||
| <Col> | ||
| <RBCard style={{ width: '18rem' }}> | ||
| <RBCard.Img variant="top" src="https://picsum.photos/100/80" /> | ||
| <RBCard.Body> | ||
| <RBCard.Title>Card Title</RBCard.Title> | ||
| <RBCard.Text> | ||
| Some quick example text to build on the card title and make up the | ||
| bulk of the card's content. | ||
| </RBCard.Text> | ||
| <RBButton variant="primary">Go somewhere</RBButton> | ||
| </RBCard.Body> | ||
| </RBCard> | ||
| </Col> | ||
| <Col> | ||
| <Card style={{ width: '18rem' }}> | ||
| <CardImg variant="top" src="https://picsum.photos/100/80" /> | ||
| <CardBody> | ||
| <CardTitle>Card Title</CardTitle> | ||
| <CardText> | ||
| Some quick example text to build on the card title and make up the | ||
| bulk of the card's content. | ||
| </CardText> | ||
| <ThemeProvider theme={theme}> | ||
| <Button variant="primary" size="medium"> | ||
| Go somewhere | ||
| </Button> | ||
| </ThemeProvider> | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| </CardBody> | ||
| </Card> | ||
| </Col> | ||
| </Row> | ||
| ); | ||
| }; | ||
|
|
||
| export default Task05; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,7 @@ | ||
| // ./src/app.js | ||
| import React from 'react'; | ||
| import { createRoot } from 'react-dom/client'; | ||
|
|
||
| import App from './components/App'; | ||
|
|
||
|
|
||
| const root = createRoot(document.querySelector('#root')); | ||
| root.render(<App />); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,10 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { StyledAlert } from './Alert.styled'; | ||
|
|
||
| const Alert = props => { | ||
| return ( | ||
| <StyledAlert>{props.children}</StyledAlert> | ||
| ); | ||
| } | ||
| const Alert = (props) => { | ||
| const { children, variant } = props; | ||
|
|
||
| return <StyledAlert variant={variant}>{children}</StyledAlert>; | ||
| }; | ||
|
|
||
| export default Alert; | ||
| export default Alert; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,13 @@ | ||
| import styled from 'styled-components'; | ||
|
|
||
| const StyledAlert = styled.div` | ||
| display: block; | ||
| ` | ||
| padding: 0.75rem 1.25rem; | ||
| margin-bottom: 1rem; | ||
| border-radius: 0.25rem; | ||
| border: 1px solid transparent; | ||
| color: ${({ variant, theme }) => variant && theme.alert[variant].color}; | ||
| background-color: ${({ variant, theme }) => | ||
| variant && theme.alert[variant].backgroundColor}; | ||
| `; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
|
||
| export { StyledAlert }; | ||
| export { StyledAlert }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import React from 'react'; | ||
| import { StyledBreadcrumb } from './Breadcrumb.styled'; | ||
|
|
||
| const Breadcrumb = (props) => { | ||
| const { children } = props; | ||
| return ( | ||
| <nav> | ||
| <StyledBreadcrumb>{children}</StyledBreadcrumb> | ||
| </nav> | ||
| ); | ||
| }; | ||
|
|
||
| export default Breadcrumb; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import styled from 'styled-components'; | ||
|
|
||
| const StyledBreadcrumb = styled.ol` | ||
| display: flex; | ||
| padding: 0.75rem 1rem; | ||
| margin-bottom: 1rem; | ||
| list-style: none; | ||
| background-color: #e9ecef; | ||
| border-radius: 0.25rem; | ||
| `; | ||
|
|
||
| export { StyledBreadcrumb }; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import React from 'react'; | ||
| import { StyledBreadcrumbItem } from './BreadcrumbItem.styled'; | ||
|
|
||
| const BreadcrumbItem = ({ href, active, children }) => { | ||
| return ( | ||
| <StyledBreadcrumbItem active={active}> | ||
| <a href={href}>{children}</a> | ||
| </StyledBreadcrumbItem> | ||
| ); | ||
| }; | ||
|
|
||
| export default BreadcrumbItem; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍