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
6 changes: 5 additions & 1 deletion 01/Task01.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React from 'react';

import Alert from './../src/components/Alert';
import { Row, Col, Alert as RBAlert } from 'react-bootstrap';
import { ThemeProvider } from 'styled-components';
import theme from '../src/components/styled/theme'

const Task01 = () => {
return (
Expand All @@ -10,7 +12,9 @@ const Task01 = () => {
<RBAlert variant="primary">Uwaga! <em>Styled Components</em> nadchodzi!</RBAlert>
</Col>
<Col>
<Alert>Uwaga! <em>Styled Components</em> nadchodzi!</Alert>
<ThemeProvider theme={theme}>
<Alert variant="primary">Uwaga! <em>Styled Components</em> nadchodzi!</Alert>
</ThemeProvider>
</Col>
</Row>
)
Expand Down
9 changes: 7 additions & 2 deletions 02/Task02.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@ import React from 'react';
import Button from './../src/components/Button';
import { Row, Col, Button as RBButton } from 'react-bootstrap';

import { ThemeProvider } from 'styled-components'
import theme from '../src/components/styled/theme'

const Task02 = () => {
return (
<Row>
<Col>
<RBButton variant="primary" size="lg">Button!</RBButton>
</Col>
<Col>
Button!
<ThemeProvider theme={theme}>
<Button variant="primary" size="lg" disabled={false}>Button!</Button>
</ThemeProvider>
</Col>
</Row>
)
)
}

export default Task02;
Expand Down
7 changes: 6 additions & 1 deletion 03/Task03.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

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

const Task03 = () => {
return (
Expand All @@ -15,7 +16,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>
</Col>
</Row>
)
Expand Down
18 changes: 17 additions & 1 deletion 04/Task04.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ 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 IsActiveContextProvider from '../src/context/IsActiveContext';

const Task04 = () => {
return (
<Row>
Expand All @@ -19,7 +23,19 @@ const Task04 = () => {
</RBTabs>
</Col>
<Col>
Tabs!
<IsActiveContextProvider>
<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>
</IsActiveContextProvider>
</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 Card from '../src/components/Card';
import Button from '../src/components/Button';

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
16 changes: 14 additions & 2 deletions src/components/Alert/Alert.styled.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
import styled from 'styled-components';

const StyledAlert = styled.div`
display: block;
const StyledAlertDefault = styled.div`
position: relative;
border: 1px solid black;
padding: 0.75rem 1.25rem;
margin-bottom: 1rem;
border-radius: 0.25rem;
`

const StyledAlert = styled(StyledAlertDefault)(
props => ({
backgroundColor: props.theme[props.variant + 'Background'],
borderColor: props.theme[props.variant + 'Border'],
color: props.theme[props.variant + 'TextColor'],
})
)

export { StyledAlert };
14 changes: 9 additions & 5 deletions src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import Task02 from './../../02/Task02';
import Task03 from './../../03/Task03';
import Task04 from './../../04/Task04';
import Task05 from './../../05/Task05';
import { ThemeProvider } from 'styled-components';
import theme from './styled/theme';


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

import { StyledBreadcrumb, OlBreadcrumb } from './Breadcrumb.styled'

const Breadcrumb = (props) => {
return (
<StyledBreadcrumb>
<OlBreadcrumb>
{props.children}
</OlBreadcrumb>
</StyledBreadcrumb>
)
}

export default Object.assign(Breadcrumb, {
Item: BreadcrumbItem
})
17 changes: 17 additions & 0 deletions src/components/Breadcrumb/Breadcrumb.styled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import styled from "styled-components";

const StyledBreadcrumb = styled.nav`
display: block;
`

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

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

export default Breadcrumb
18 changes: 18 additions & 0 deletions src/components/BreadcrumbItem/BreadcrumbItem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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
25 changes: 25 additions & 0 deletions src/components/BreadcrumbItem/BreadcrumbItem.styled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import styled, { css } from "styled-components";

const StyledBreadcrumbItem = styled.li`
display: inline-block;

&::before {
display: inline-block;
padding: 0 0.5rem;
color: #6c757d;
content: "/";
}

&:first-child::before {
padding-left: 0;
padding-right: 0.5rem;
content: "";
}

${props => props.active && css`
color: #6c757d;
`
}
`

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

export default 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 = props => {
return (
<StyledButton variant={props.variant} size={props.size} disabled={props.disabled}>{props.children}</StyledButton>
)
}

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

const StyledButton = styled.button`
display: inline-block;
font-weight: 400;
color: #212529;
text-align: center;
vertical-align: middle;
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;
transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;

${props => props.variant === 'primary' && css`
background-color: ${props.theme.primaryBackground};
border-color: ${props.theme.primaryBorder};
color: ${props.theme.primaryTextColor};
`};

${props => props.variant === 'secondary' && css`
background-color: ${props.theme.secondaryBackground};
border-color: ${props.theme.secondaryBorder};
color: ${props.theme.secondaryTextColor};
`};

${props => props.size === 'lg' && css`
padding: 0.5rem 1rem;
font-size: 1.25rem;
line-height: 1.5;
border-radius: 0.3rem;
`};

&:hover {
cursor: pointer;
background-color: #00000030
}

&:focus {
background-color: #00000030;
outline: 0;
box-shadow: 0 0 0 0.2rem ${props => props.theme[props.variant + 'Border']};
}

&:active {
background-color: #00000030
}

&:disabled {
background-color: #A9C9C9
}
`

// const StyledButton = styled(StyledButtonDefault)(
// props => ({
// backgroundColor: props.theme[props.variant + 'Background'],
// borderColor: props.theme[props.variant + 'Border'],
// color: props.theme[props.variant + 'TextColor']
// })
// )

export { StyledButton }
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
21 changes: 21 additions & 0 deletions src/components/Card/Card.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from "react";

import { StyledCard } from "./Card.styled";
import CardImg from "../CardImg";
import CardBody from "../CardBody";
import CardTitle from "../CardTitle";
import CardText from "../CardText";

const Card = (props) => {
const { children } = props
return (
<StyledCard style={props.style}>{children}</StyledCard>
)
}

export default Object.assign(Card, {
Img: CardImg,
Body: CardBody,
Title: CardTitle,
Text: CardText
})
Loading