-
-
Notifications
You must be signed in to change notification settings - Fork 76
practice-react-styling #56
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
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,23 @@ | ||
| import React from 'react'; | ||
| import React from "react"; | ||
|
|
||
| import Alert from './../src/components/Alert'; | ||
| import { Row, Col, Alert as RBAlert } from 'react-bootstrap'; | ||
| import Alert from "./../src/components/Alert/"; | ||
| import { Row, Col, Alert as RBAlert } from "react-bootstrap"; | ||
|
|
||
| const Task01 = () => { | ||
| return ( | ||
| <Row> | ||
| <Col> | ||
| <RBAlert variant="primary">Uwaga! <em>Styled Components</em> nadchodzi!</RBAlert> | ||
| <RBAlert variant="primary"> | ||
| Uwaga! <em>Styled Components</em> nadchodzi! | ||
| </RBAlert> | ||
| </Col> | ||
| <Col> | ||
| <Alert>Uwaga! <em>Styled Components</em> nadchodzi!</Alert> | ||
| <Alert> | ||
| Uwaga! <em>Styled Components</em> nadchodzi! | ||
| </Alert> | ||
| </Col> | ||
| </Row> | ||
| ) | ||
| } | ||
| ); | ||
| }; | ||
|
|
||
| export default Task01; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,23 @@ | ||
| import React from 'react'; | ||
| import React from "react"; | ||
|
|
||
| import Button from './../src/components/Button'; | ||
| import { Row, Col, Button as RBButton } from 'react-bootstrap'; | ||
| import Button from "./../src/components/Button"; | ||
| import { Row, Col, Button as RBButton } from "react-bootstrap"; | ||
|
|
||
| const Task02 = () => { | ||
| return ( | ||
| <Row> | ||
| <Col> | ||
| <RBButton variant="primary" size="lg">Button!</RBButton> | ||
| <RBButton variant="primary" size="lg"> | ||
| Button! | ||
| </RBButton> | ||
| </Col> | ||
| <Col> | ||
| Button! | ||
| <Button variant="secondary" size="lg"> | ||
| Button! | ||
| </Button> | ||
|
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> | ||
| ) | ||
| } | ||
| ); | ||
| }; | ||
|
|
||
| export default Task02; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| import React from 'react'; | ||
| import React from "react"; | ||
|
|
||
| import { Row, Col, Breadcrumb as RBBreadcrumb } from 'react-bootstrap'; | ||
| import { Row, Col, Breadcrumb as RBBreadcrumb } from "react-bootstrap"; | ||
| import Breadcrumb from "../src/components/Breadcrumbs/index"; | ||
|
|
||
| const Task03 = () => { | ||
| return ( | ||
|
|
@@ -15,11 +16,16 @@ const Task03 = () => { | |
| </RBBreadcrumb> | ||
| </Col> | ||
| <Col> | ||
| Breadcrumb! | ||
| <Breadcrumb> | ||
| <Breadcrumb.Item href="#">Home</Breadcrumb.Item> | ||
| <Breadcrumb.Item href="https://getbootstrap.com/docs/4.0/components/breadcrumb/"> | ||
| Library | ||
| </Breadcrumb.Item> | ||
| <Breadcrumb.Item active>Data</Breadcrumb.Item> | ||
| </Breadcrumb> | ||
|
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> | ||
| ) | ||
| } | ||
| ); | ||
| }; | ||
|
|
||
| export default Task03; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,80 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { Row, Col, Tabs as RBTabs, Tab as RBTab, } from 'react-bootstrap'; | ||
| import React from "react"; | ||
| import { Tab, Tabs } from "../src/components/Tabs/index"; | ||
| import { Row, Col, Tabs as RBTabs, Tab as RBTab } from "react-bootstrap"; | ||
|
|
||
| const Task04 = () => { | ||
| return ( | ||
| <Row> | ||
| <Col> | ||
| <RBTabs defaultActiveKey="profile" id="uncontrolled-tab-example"> | ||
| <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> | ||
| <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> | ||
| <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> | ||
| <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! | ||
| <Tabs> | ||
| <Tab label="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 label="Profile" active> | ||
| <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 label="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> | ||
| </Tab> | ||
| </Tabs> | ||
|
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> | ||
| ) | ||
| } | ||
|
|
||
| ); | ||
| }; | ||
| export default Task04; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,31 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { Row, Col, Card as RBCard, Button as RBButton } from 'react-bootstrap'; | ||
| import React from "react"; | ||
|
|
||
| import { Row, Col, Card as RBCard, Button as RBButton } from "react-bootstrap"; | ||
| import Card 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 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. | ||
| 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! | ||
| <Card /> | ||
|
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> | ||
| ) | ||
| } | ||
| ); | ||
| }; | ||
|
|
||
| export default Task05; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,9 @@ | ||
| import React from 'react'; | ||
| import React from "react"; | ||
|
|
||
| import { StyledAlert } from './Alert.styled'; | ||
| import { StyledAlert } from "./Alert.styled"; | ||
|
|
||
| const Alert = props => { | ||
| return ( | ||
| <StyledAlert>{props.children}</StyledAlert> | ||
| ); | ||
| } | ||
| const Alert = ({ variant, children }) => { | ||
| 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,19 @@ | ||
| import styled from 'styled-components'; | ||
| import styled from "styled-components"; | ||
|
|
||
| const StyledAlert = styled.div` | ||
| display: block; | ||
| ` | ||
| padding: 0.75rem 1.25rem; | ||
|
|
||
| export { StyledAlert }; | ||
| margin-bottom: 1rem; | ||
|
|
||
| border: 1px solid transparent; | ||
|
|
||
| border-radius: 0.25rem; | ||
|
|
||
| color: #004085; | ||
|
|
||
| background-color: ${(props) => props.theme[props.variant] || "#031633"}; | ||
|
|
||
| border-color: ${(props) => props.theme[props.variant] || "#6ea8fe"}; | ||
| `; | ||
|
|
||
| export { StyledAlert }; | ||
|
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 |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| import Alert from './Alert'; | ||
| import Alert from "./Alert"; | ||
|
|
||
|
|
||
| export default Alert; | ||
| export default Alert; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,38 @@ | ||
| import React from 'react'; | ||
| import { Container, Row, Col } from 'react-bootstrap'; | ||
| import React from "react"; | ||
| import { Container, Row, Col } from "react-bootstrap"; | ||
| import { ThemeProvider } from "styled-components"; | ||
|
|
||
| import Task01 from './../../01/Task01'; | ||
| import Task02 from './../../02/Task02'; | ||
| import Task03 from './../../03/Task03'; | ||
| import Task04 from './../../04/Task04'; | ||
| import Task05 from './../../05/Task05'; | ||
| import Task01 from "./../../01/Task01"; | ||
| import Task02 from "./../../02/Task02"; | ||
| import Task03 from "./../../03/Task03"; | ||
| import Task04 from "./../../04/Task04"; | ||
| import Task05 from "./../../05/Task05"; | ||
|
|
||
| const theme = { | ||
| primary: "#007bff", | ||
| secondary: "#6c757d", | ||
| }; | ||
|
|
||
| const App = () => { | ||
| return ( | ||
| <> | ||
| <ThemeProvider theme={theme}> | ||
| <Container fluid> | ||
| <Row> | ||
| <Col> | ||
| <h2>Komponenty React Boostrap</h2></Col> | ||
| <h2>Komponenty React Boostrap</h2> | ||
| </Col> | ||
| <Col> | ||
| <h2>Komponenty Twoje</h2> | ||
| </Col> | ||
| </Row> | ||
| <Task01/> | ||
| <Task02/> | ||
| <Task03/> | ||
| <Task04/> | ||
| <Task05/> | ||
| <Task01 /> | ||
| <Task02 /> | ||
| <Task03 /> | ||
| <Task04 /> | ||
| <Task05 /> | ||
|
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. 👍 |
||
| </Container> | ||
| </> | ||
| ) | ||
| } | ||
| </ThemeProvider> | ||
| ); | ||
| }; | ||
|
|
||
| export default App; | ||
| export default App; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import React from "react"; | ||
| import { StyledBreadcrumb } from "./Breadcrumb.styled"; | ||
| import BreadcrumbItem from "./BreadcrumbItem"; | ||
|
|
||
| const Breadcrumb = ({ children }) => { | ||
| return ( | ||
| <StyledBreadcrumb aria-label="breadcrumb"> | ||
| <ol>{children}</ol> | ||
| </StyledBreadcrumb> | ||
| ); | ||
| }; | ||
|
|
||
| Breadcrumb.Item = BreadcrumbItem; | ||
|
|
||
| export default Breadcrumb; | ||
|
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,15 @@ | ||
| import styled from "styled-components"; | ||
|
|
||
| const StyledBreadcrumb = styled.ol` | ||
| display: flex; | ||
| -ms-flex-wrap: wrap; | ||
| flex-wrap: wrap; | ||
| padding: 0.75rem 0; | ||
| margin-bottom: 1rem; | ||
| list-style: none; | ||
| background-color: #444950; | ||
| border-radius: 0.25rem; | ||
| justify-content: flex-start; | ||
| `; | ||
|
|
||
| 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}> | ||
| {href ? <a href={href}>{children}</a> : children} | ||
| </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.
👍