Skip to content
2 changes: 1 addition & 1 deletion 01/Task01.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Task01 = () => {
<RBAlert variant="primary">Uwaga! <em>Styled Components</em> nadchodzi!</RBAlert>
</Col>
<Col>
<Alert>Uwaga! <em>Styled Components</em> nadchodzi!</Alert>
<Alert variant="primary">Uwaga! <em>Styled Components</em> nadchodzi!</Alert>
</Col>
</Row>
)
Expand Down
4 changes: 2 additions & 2 deletions 02/Task02.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ const Task02 = () => {
return (
<Row>
<Col>
<RBButton variant="primary" size="lg">Button!</RBButton>
<RBButton variant="primary" size="lg" active>Button!</RBButton>
</Col>
<Col>
Button!
<Button variant="primary" active>Button!</Button>
</Col>
</Row>
)
Expand Down
47 changes: 27 additions & 20 deletions 03/Task03.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
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/Breadrumb";

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 (
<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>
<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>
</Col>
</Row>
);
};

export default Task03;

14 changes: 13 additions & 1 deletion 04/Task04.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React from 'react';

import { Row, Col, Tabs as RBTabs, Tab as RBTab, } from 'react-bootstrap';

import { Tabs, Tab } from './../src/components/Tabs'

const Task04 = () => {
return (
<Row>
Expand All @@ -19,7 +21,17 @@ const Task04 = () => {
</RBTabs>
</Col>
<Col>
Tabs!
<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">
<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>
<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>
)
Expand Down
15 changes: 14 additions & 1 deletion 05/Task05.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import React from 'react';

import { Row, Col, Card as RBCard, Button as RBButton } from 'react-bootstrap';

import Button from './../src/components/Button'
import Card from './../src/components/Card'

const Task05 = () => {
return (
<Row>
Expand All @@ -19,7 +22,17 @@ const Task05 = () => {
</RBCard>
</Col>
<Col>
Card!
<Card style={{ width: '18rem' }}>
<Card.Img variant="top" src="https://picsum.photos/100/80" />
<Card.Body>
<Card.Title>Card Title</Card.Title>
<Card.Text>
Some quick example text to build on the card title and make up the bulk of
the card's content.
</Card.Text>
<Button variant="primary">Go somewhere</Button>
</Card.Body>
</Card>
</Col>
</Row>
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/Alert/Alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { StyledAlert } from './Alert.styled';

const Alert = props => {
return (
<StyledAlert>{props.children}</StyledAlert>
<StyledAlert variant={props.variant}>{props.children}</StyledAlert>
);
}

Expand Down
10 changes: 8 additions & 2 deletions src/components/Alert/Alert.styled.js
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;
const DefaultStyledAlert = styled.div`
position: relative;
padding: 0.75rem 1.25rem;
margin-bottom: 1rem;
border: 1px solid transparent;
border-radius: 0.25rem
`

const StyledAlert = styled(DefaultStyledAlert)(({theme, variant}) => theme.alert[variant])

export { StyledAlert };
91 changes: 77 additions & 14 deletions src/components/App.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,93 @@
import React from 'react';
import { Container, Row, Col } from 'react-bootstrap';
import { ThemeProvider, css } 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 StyledGlobal from './styled/Global'

const theme = {
alert: {
primary: css`
color: #004085;
background-color: #cce5ff;
border-color: #b8daff;

&:hover {
color: #fff;
background-color: #0069d9;
border-color: #0062cc;
}
`,
secondary: css`
color: #383d41;
background-color: #e2e3e5;
border-color: #d6d8db;

&:hover {
color: #fff;
background-color: #5a6268;
border-color: #545b62;
}
`

},
button: {
variant: {
primary: css`
color: #fff;
background-color: #007bff;
border-color: #007bff;
`,
secondary: css`
color: #fff;
background-color: #6c757d;
border-color: #6c757d;

`
},
size: {
lg: css`
padding: 0.5rem 1rem;
font-size: 1.25rem;
line-height: 1.5rem;
border-radius: 0.3rem;
`,
sm: css`
padding: 0.25rem 0.5rem;
font-size: 0.875rem;
line-height: 1.5rem;
border-radius: 0.2rem;
`
}
}
}


const App = () => {
return (
<>
<Container fluid>
<Row>
<Col>
<h2>Komponenty React Boostrap</h2></Col>
<Col>
<h2>Komponenty Twoje</h2>
</Col>
</Row>
<Task01/>
<Task02/>
<Task03/>
<Task04/>
<Task05/>
</Container>
<ThemeProvider theme={theme}>
<StyledGlobal />
<Container fluid>
<Row>
<Col>
<h2>Komponenty React Boostrap</h2></Col>
<Col>
<h2>Komponenty Twoje</h2>
</Col>
</Row>
<Task01/>
<Task02/>
<Task03/>
<Task04/>
<Task05/>
</Container>
</ThemeProvider>
</>
)
}
Expand Down
11 changes: 11 additions & 0 deletions src/components/Breadrumb/Breadcrumb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';

import StyledBreadcrumb from './Breadcrumb.styled';

const Breadcrumb = ({variant, children}) => {
return (
<StyledBreadcrumb variant={variant}>{children}</StyledBreadcrumb>
);
}

export default Breadcrumb;
17 changes: 17 additions & 0 deletions src/components/Breadrumb/Breadcrumb.styled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import styled from 'styled-components';

const DefaultStyledBreadCrumb = styled.ol`
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
padding: 0.75rem 1rem;
margin-bottom: 1rem;
list-style: none;
background-color: #e9ecef;
border-radius: 0.25rem;
`



export default DefaultStyledBreadCrumb;
13 changes: 13 additions & 0 deletions src/components/Breadrumb/BreadcrumbItem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';

import StyledBreadcrumbItem from './BreadcrumbItem.styled';

const BreadcrumbItem = props => {
return (
<StyledBreadcrumbItem active={props.active}>
{props.href ? <a href={props.href}>{props.children}</a> : props.children }
</StyledBreadcrumbItem>
);
}

export default BreadcrumbItem;
16 changes: 16 additions & 0 deletions src/components/Breadrumb/BreadcrumbItem.styled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import styled from 'styled-components';

const DefaultStyledBreadCrumbItem = styled.li`
color: ${({active}) => active ? '#6c757d' : 'red'};
& + & {
padding-left: 0.5rem;
}
& + &::before {
display: inline-block;
padding-right: 0.5rem;
color: #6c757d;
content: "/";
}
`

export default DefaultStyledBreadCrumbItem;
9 changes: 9 additions & 0 deletions src/components/Breadrumb/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'
import BreadCrumb from './Breadcrumb'
import BreadcrumbItem from './BreadcrumbItem'



export default Object.assign(BreadCrumb, {
Item: BreadcrumbItem
});
11 changes: 11 additions & 0 deletions src/components/Button/Button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';

import { StyledButton } from './Button.styled';

const Button = ({variant, size = 'lg', children}) => {
return (
<StyledButton variant={variant} size={size}>{children}</StyledButton>
);
}

export default Button;
33 changes: 33 additions & 0 deletions src/components/Button/Button.styled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import styled from 'styled-components';

const DefaultStyledButton = styled.button`
display: inline-block;
font-weight: 400;
color: #212529;
text-align: center;
vertical-align: middle;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-color: transparent;
border: 1px solid transparent;
padding: 0.375rem 0.75rem;
font-size: 1rem,
line-height: 1.5;
border-radius: 0.25rem;

&:hover {
color: #212529;
text-decoration: none;
}
`

const VariantStyledButton = styled(DefaultStyledButton)(({theme, variant}) => theme.button.variant[variant])

const SizedStyledButton = styled(VariantStyledButton)(({theme, size}) => theme.button.size[size])

const StyledButton = SizedStyledButton

export { StyledButton };
4 changes: 4 additions & 0 deletions src/components/Button/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Button from './Button';


export default Button;
Loading