-
-
Notifications
You must be signed in to change notification settings - Fork 78
Finish #54
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?
Finish #54
Changes from 2 commits
229cc11
c59b5df
71e127d
4c49784
375ed6d
0823a23
89ae681
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 |
|---|---|---|
|
|
@@ -23,7 +23,7 @@ const Task04 = () => { | |
| <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"> | ||
| <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> | ||
|
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. Ten miał być nieklikany :P |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,18 @@ | ||
| import React from "react"; | ||
| import { TabButton } from "./Tabs.styled"; | ||
|
|
||
| const Tab = ({ label, active, children, onClick }) => { | ||
| const Tab = ({ label, active, disabled, children, onClick }) => { | ||
| const handleClick = () => { | ||
| if (!disabled) { | ||
| onClick(label); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <TabButton | ||
| onClick={() => onClick(label)} | ||
| className={active ? "active" : ""} | ||
| onClick={handleClick} | ||
| className={`${active ? "active" : ""} ${disabled ? "disabled" : ""}`} | ||
| disabled={disabled} | ||
|
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. 👍 |
||
| > | ||
| {label} | ||
| </TabButton> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ import React, { useState } from 'react'; | |
| import { TabList, TabsContainer, TabContent } from './Tabs.styled'; | ||
|
|
||
| const Tabs = ({ children }) => { | ||
| const [activeTab, setActiveTab] = useState(children[0].props.label); | ||
| const [activeTab, setActiveTab] = useState('Profile'); | ||
|
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. 👍 |
||
|
|
||
| const handleClick = (label) => { | ||
| setActiveTab(label); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,11 +31,20 @@ const TabButton = styled.button` | |
| background-color: #fff; | ||
| border-color: #dee2e6 #dee2e6 #fff; | ||
| } | ||
|
|
||
| &:not(.active) { | ||
| color: #007bff; | ||
| } | ||
|
|
||
| &:not(.active):hover { | ||
| border0color: transparent; | ||
| color: #0056b3; | ||
| } | ||
|
|
||
| &.disabled { | ||
| color: #6c757d; | ||
| cursor: default; | ||
| } | ||
|
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. 👍 |
||
| `; | ||
|
|
||
| const TabContent = styled.div` | ||
|
|
||
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.
👍