Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion 01/Task01.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ 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>
<Alert variant="secondary">Uwaga! <em>Styled Components</em> nadchodzi!</Alert>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

</Col>
</Row>
)
Expand Down
3 changes: 2 additions & 1 deletion 02/Task02.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const Task02 = () => {
<RBButton variant="primary" size="lg">Button!</RBButton>
</Col>
<Col>
Button!
<Button variant="primary" size="lg" active>Button!</Button>
<Button variant="secondary" size="sm" disabled>Button!</Button>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

</Col>
</Row>
)
Expand Down
8 changes: 6 additions & 2 deletions 03/Task03.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';

import Breadcrumb from '../src/components/Breadcrumb/Breadcrumb';
import { Row, Col, Breadcrumb as RBBreadcrumb } from 'react-bootstrap';

const Task03 = () => {
Expand All @@ -15,7 +15,11 @@ 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>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

</Col>
</Row>
)
Expand Down
67 changes: 44 additions & 23 deletions 04/Task04.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,50 @@
import React from 'react';

import { Row, Col, Tabs as RBTabs, Tab as RBTab, } from 'react-bootstrap';
import Tabs from "./../src/components/Tabs";
import Tab from "./../src/components/Tab";
import { Row, Col, Tabs as RBTabs, Tab as RBTab } from "react-bootstrap";

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 activeKey='profile'>
<Tab eventKey="home" title="Home"><p>Home home</p></Tab>
<Tab eventKey="profile" title="Profile"><p>Profile profile</p></Tab>
<Tab eventKey="contact" title="Contact"disabled><p>Contact contact</p></Tab>
</Tabs>
</Col>
</Row>
);
};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


export default Task04;

57 changes: 35 additions & 22 deletions 05/Task05.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,42 @@
import React from 'react';
import Card from "../src/components/Card/Card";
import Button from '../src/components/Button/Button';

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

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>
<Card.Img 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" size='sm' active>Go somewhere</Button>
</Card.Body>
</Card>
</Col>
</Row>
);
};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


export default Task05;

10 changes: 7 additions & 3 deletions src/components/Alert/Alert.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import React from 'react';

import { StyledAlert } from './Alert.styled';
import { ThemeProvider } from 'styled-components';

const Alert = props => {
const Alert = ({children, variant}) => {
const theme = variant === 'primary' ? { colorAlfa: '#113f67' } : { colorAlfa: '#a2a8d3' };
return (
<StyledAlert>{props.children}</StyledAlert>
<ThemeProvider theme={theme}>
<StyledAlert variant={ variant }>{children}</StyledAlert>
</ThemeProvider>

);
}

Expand Down
11 changes: 10 additions & 1 deletion src/components/Alert/Alert.styled.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ import styled from 'styled-components';

const StyledAlert = styled.div`
display: block;
padding: 12px 20px;
margin: 0 0 10px;
--color-alfa: ${ props => props.theme.colorAlfa};
color: var(--color-alfa);
border-radius: 5px;
background-color: ${
props => props.variant === 'primary'
? '#5585b5' : '#bbe4e9'
};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

`

export { StyledAlert };
export { StyledAlert };
13 changes: 13 additions & 0 deletions src/components/Breadcrumb/Breadcrumb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from "react";
import BreadcrumbItem from "./BreadcrumbItem";

const Breadcrumb = ({children}) => {
const style = {display: 'flex'}
return (
<nav><ul style={style}>{children}</ul></nav>
)
}

Breadcrumb.Item = BreadcrumbItem;

export default Breadcrumb;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gdzie odpowiednie tło dla okruchów chleba? :P

10 changes: 10 additions & 0 deletions src/components/Breadcrumb/BreadcrumbItem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from "react";
import { StyledBreadItem } from "./BreadcrumbItem.styled";

const BreadcrumbItem = ({children, href, active}) => {
return (
<StyledBreadItem active={active}><a href={href}>{children}</a></StyledBreadItem>
)
}

export default BreadcrumbItem;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

21 changes: 21 additions & 0 deletions src/components/Breadcrumb/BreadcrumbItem.styled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import styled from "styled-components";

const StyledBreadItem = styled.li`
list-style-type: none;
&:nth-child(1) {
&:before {
content: none;
}
}
&:before {
content: "/";
padding: 10px;
color: grey;
}
${({ active }) =>
active &&
`color: grey;
`}
`;

export { StyledBreadItem };
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

16 changes: 16 additions & 0 deletions src/components/Button/Button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React, { useState } from "react";

import { StyledButton, theme } from "./Button.styled";
import { ThemeProvider } from "styled-components";

const Button = ({children, variant, size, disabled, active}) => {
const [isActive, setIsActive] = useState(false);

return (
<ThemeProvider theme={theme}>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Motyw najlepiej zdefiniować jak najwyżej w strukturze komponentów (np. w App), aby nie trzeba było go definiować wielokrotnie dla każdego elementu. Rozumiem, że w tym zadaniu było tak wygodniej, ale już w projekcie nalezy to zrobić inaczej ;)

<StyledButton onClick={() => setIsActive(true)} variant={ variant } size={ size } disabled={ disabled } active={ active }>{children}</StyledButton>
</ThemeProvider>
)
}

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



const theme = {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docelowo w projekcie mamy 1 motyw. Ewentualnie można definiować wartości domyślne tutaj.
Pamiętaj, że motyw to ma być rozwiązanie, które pozwoli Ci nadać kompletnie nowe "kolory i wielkości" bez potrzeby modyfikowania plików "standardowych"

button: {
primary: {
backgroundColor: '#0069D9',
color: '#fff',
hoverBackgroundColor: '#0022D9',
activeBackgroundColor: '#0022D9',
activeOutline: '3px solid #0099D9',
},
secondary: {
backgroundColor: '#5585b5',
color: '#fff',
hoverBackgroundColor: '#5055c5',
activeBackgroundColor: '#5055c5',
activeOutline: '3px solid #5585b5'
},
sizes: {
lg: {
padding: '8px 16px',
fontSize: '20px',
},
sm: {
padding: '6px 10px',
fontSize: '16px',
},
},
},
};

const StyledButton = styled.button`
border-radius: 5px;
border: 3px solid transparent;
margin: 10px 5px;
&:disabled {
opacity: 0.5;
pointer-events: none;
}
&:focus {
outline: none;
}
${({ theme, variant }) =>
variant === 'primary' &&
css`
background-color: ${theme.button.primary.backgroundColor};
color: ${theme.button.primary.color};
&:hover {
background-color: ${theme.button.primary.hoverBackgroundColor};
transition: 300ms;
}
`}
${({ theme, variant, active }) =>
variant === 'primary' && active &&
css`
&:focus {
background-color: ${theme.button.primary.activeBackgroundColor};
outline: ${theme.button.primary.activeOutline};
transition: 100ms;
}
`}
${({ theme, variant }) =>
variant === 'secondary' &&
css`
background-color: ${theme.button.secondary.backgroundColor};
color: ${theme.button.secondary.color};
&:hover {
background-color: ${theme.button.secondary.hoverBackgroundColor};
}
`}
${({ theme, variant, active }) =>
variant === 'secondary' && active &&
css`
&:focus {
background-color: ${theme.button.secondary.activeBackgroundColor};
outline: ${theme.button.secondary.activeOutline};
}
`}

${({ theme, size }) =>
size === 'lg' &&
css`
padding: ${theme.button.sizes.lg.padding};
font-size: ${theme.button.sizes.lg.fontSize};
`}

${({ theme, size }) =>
size === 'sm' &&
css`
padding: ${theme.button.sizes.sm.padding};
font-size: ${theme.button.sizes.sm.fontSize};
`}
}
`;

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

export default Button;
Loading