-
-
Notifications
You must be signed in to change notification settings - Fork 76
zadania #70
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
Open
Dariadaria01
wants to merge
3
commits into
devmentor-pl:master
Choose a base branch
from
Dariadaria01:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
zadania #70
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import React from 'react'; | ||
| import { StyledAlert } from './Alert.styled'; | ||
|
|
||
| const Alert = ({ children, variant = 'primary' }) => { | ||
| return ( | ||
| <StyledAlert variant={variant}> | ||
| {children} | ||
| </StyledAlert> | ||
| ); | ||
| }; | ||
|
|
||
| export default Alert; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import styled from 'styled-components'; | ||
|
|
||
| const defaultColors = { | ||
| primary: { | ||
| background: '#cfe2ff', | ||
| text: '#084298', | ||
| border: '#b6d4fe', | ||
| }, | ||
| secondary: { | ||
| background: '#e2e3e5', | ||
| text: '#41464b', | ||
| border: '#d3d6d8', | ||
| }, | ||
| }; | ||
|
|
||
| export const StyledAlert = styled.div` | ||
| ${({ theme, variant = 'primary' }) => { | ||
| const colors = | ||
| theme?.alert?.[variant] || defaultColors[variant]; | ||
| return ` | ||
| padding: 16px; | ||
| border-radius: 4px; | ||
| background-color: ${colors.background}; | ||
| color: ${colors.text}; | ||
| border: 1px solid ${colors.border}; | ||
| `; | ||
| }} | ||
| `; | ||
|
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. 👍 |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| import Alert from './../src/components/Alert'; | ||
| import Alert from './Alert'; | ||
|
|
||
| export default Alert; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,24 @@ | ||
| import React from 'react'; | ||
|
|
||
| import Button from './../src/components/Button'; | ||
| import Button, { ButtonThemeProvider } 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> | ||
| </Col> | ||
| <Col> | ||
| Button! | ||
| </Col> | ||
| </Row> | ||
| ) | ||
| } | ||
|
|
||
| export default Task02; | ||
| return ( | ||
| <ButtonThemeProvider> | ||
| <Row> | ||
| <Col> | ||
| <RBButton variant='primary' size='lg'> | ||
| RB Button! | ||
| </RBButton> | ||
| </Col> | ||
| <Col> | ||
| <Button variant='primary' size='lg' active> | ||
| Custom Button! | ||
| </Button> | ||
| </Col> | ||
| </Row> | ||
| </ButtonThemeProvider> | ||
| ); | ||
| }; | ||
|
|
||
| export default Task02; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import React, { useContext } from 'react'; | ||
| import { ButtonThemeContext } from './ButtonThemeProvider'; | ||
| import { getButtonStyles } from './Button.styles'; | ||
|
|
||
| const Button = ({ | ||
| children, | ||
| variant = 'primary', | ||
| size = 'sm', | ||
| active = false, | ||
| disabled = false, | ||
| ...rest | ||
| }) => { | ||
| const theme = useContext(ButtonThemeContext); | ||
|
|
||
| const styles = getButtonStyles({ | ||
| variant, | ||
| size, | ||
| active, | ||
| disabled, | ||
| theme, | ||
| }); | ||
|
|
||
| return ( | ||
| <button style={styles} disabled={disabled} {...rest}> | ||
| {children} | ||
| </button> | ||
| ); | ||
| }; | ||
|
|
||
| export default 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. 👍 |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| export const getButtonStyles = ({ | ||
| variant, | ||
| size, | ||
| active, | ||
| disabled, | ||
| theme, | ||
| }) => { | ||
| const variantStyles = theme.variants[variant]; | ||
| const sizeStyles = theme.sizes[size]; | ||
|
|
||
| return { | ||
| backgroundColor: variantStyles.background, | ||
| color: variantStyles.color, | ||
| padding: sizeStyles.padding, | ||
| fontSize: sizeStyles.fontSize, | ||
| border: 'none', | ||
| borderRadius: '0.375rem', | ||
| cursor: disabled ? 'not-allowed' : 'pointer', | ||
| opacity: disabled ? 0.6 : 1, | ||
| boxShadow: active ? 'inset 0 3px 5px rgba(0,0,0,.125)' : 'none', | ||
| }; | ||
| }; | ||
|
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. 👍 |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import React, { createContext } from 'react'; | ||
|
|
||
| export const ButtonThemeContext = createContext(); | ||
|
|
||
| const defaultTheme = { | ||
| variants: { | ||
| primary: { | ||
| background: '#0d6efd', | ||
| color: '#fff', | ||
| }, | ||
| secondary: { | ||
| background: '#6c757d', | ||
| color: '#fff', | ||
| }, | ||
| }, | ||
| sizes: { | ||
| sm: { | ||
| padding: '0.25rem 0.5rem', | ||
| fontSize: '0.875rem', | ||
| }, | ||
| lg: { | ||
| padding: '0.5rem 1rem', | ||
| fontSize: '1.25rem', | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| const ButtonThemeProvider = ({ theme = defaultTheme, children }) => { | ||
| return ( | ||
| <ButtonThemeContext.Provider value={theme}> | ||
| {children} | ||
| </ButtonThemeContext.Provider> | ||
| ); | ||
| }; | ||
|
|
||
| export default ButtonThemeProvider; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export { default } from './Button'; | ||
| export { default as ButtonThemeProvider } from './ButtonThemeProvider'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,26 @@ | ||
| import React from 'react'; | ||
| import { Row, Col } from 'react-bootstrap'; | ||
|
|
||
| import { Row, Col, Breadcrumb as RBBreadcrumb } from 'react-bootstrap'; | ||
| import Breadcrumb from './src/components/Breadcrumb'; | ||
|
|
||
| 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> | ||
| <Breadcrumb> | ||
| <Breadcrumb.Item href='#'>Home</Breadcrumb.Item> | ||
|
|
||
| export default Task03; | ||
| <Breadcrumb.Item href='https://getbootstrap.com/docs/4.0/components/breadcrumb/'> | ||
| Library | ||
| </Breadcrumb.Item> | ||
|
|
||
| <Breadcrumb.Item active>Data</Breadcrumb.Item> | ||
| </Breadcrumb> | ||
| </Col> | ||
|
|
||
| <Col>Breadcrumb!</Col> | ||
| </Row> | ||
| ); | ||
| }; | ||
|
|
||
| export default Task03; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import React from 'react'; | ||
| import BreadcrumbItem from './BreadcrumbItem'; | ||
|
|
||
|
|
||
| const Breadcrumb = ({ children }) => { | ||
| return ( | ||
|
|
||
| <nav aria-label="breadcrumb"> | ||
| <ol className="breadcrumb"> | ||
| {children} | ||
| </ol> | ||
| </nav> | ||
| ); | ||
| }; | ||
|
|
||
|
|
||
|
|
||
| Breadcrumb.Item = BreadcrumbItem; | ||
|
|
||
| export default Breadcrumb; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import React from 'react'; | ||
|
|
||
|
|
||
| const BreadcrumbItem = ({ href, active, children }) => { | ||
|
|
||
| if (active) { | ||
| return ( | ||
| <li className="breadcrumb-item active" aria-current="page"> | ||
| {children} | ||
| </li> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <li className="breadcrumb-item"> | ||
| <a href={href}> | ||
| {children} | ||
| </a> | ||
| </li> | ||
| ); | ||
| }; | ||
|
|
||
| export default BreadcrumbItem; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import Breadcrumb from './Breadcrumb'; | ||
|
|
||
| export default Breadcrumb; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,40 @@ | ||
| import React from 'react'; | ||
| import { Row, Col } from 'react-bootstrap'; | ||
|
|
||
| import { Row, Col, Tabs as RBTabs, Tab as RBTab, } from 'react-bootstrap'; | ||
| import Tabs from './src/components/Tabs/Tabs'; | ||
| import Tab from './src/components/Tabs/Tab'; | ||
|
|
||
| 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> | ||
| <Tabs defaultActiveKey='profile'> | ||
| <Tab eventKey='home' title='Home'> | ||
| <p> | ||
| Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur | ||
| condimentum lacus nec ligula faucibus rhoncus. | ||
| </p> | ||
| </Tab> | ||
|
|
||
| export default Task04; | ||
| <Tab eventKey='profile' title='Profile'> | ||
| <p> | ||
| Donec dignissim ultricies felis, eu dictum eros congue in. In | ||
| gravida lobortis libero nec tempus. | ||
| </p> | ||
| </Tab> | ||
|
|
||
| <Tab eventKey='contact' title='Contact' disabled> | ||
| <p> | ||
| Vivamus metus nulla, fermentum eget placerat vitae, mollis | ||
| interdum elit. | ||
| </p> | ||
| </Tab> | ||
| </Tabs> | ||
| </Col> | ||
|
|
||
| <Col>Tabs!</Col> | ||
| </Row> | ||
| ); | ||
| }; | ||
|
|
||
| export default Task04; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| .tabs__nav { | ||
| display: flex; | ||
| gap: 8px; | ||
| margin-bottom: 16px; | ||
| } | ||
|
|
||
| .tabs__button { | ||
| padding: 8px 16px; | ||
| border: 1px solid #ccc; | ||
| background: #f5f5f5; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| .tabs__button.active { | ||
| background: #007bff; | ||
| color: white; | ||
| border-color: #007bff; | ||
| } | ||
|
|
||
| .tabs__button:disabled { | ||
| opacity: 0.5; | ||
| cursor: not-allowed; | ||
| } | ||
|
|
||
| .tabs__content { | ||
| padding: 16px; | ||
| border: 1px solid #ccc; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| const Tab = ({ children }) => { | ||
|
|
||
| return children; | ||
| }; | ||
|
|
||
| export default Tab; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
👍