-
Notifications
You must be signed in to change notification settings - Fork 5
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
Close prop on tab and tabBar #43
base: master
Are you sure you want to change the base?
Close prop on tab and tabBar #43
Conversation
gustavoFreireS
commented
Aug 16, 2019
- possible to have closeable prop on individual tabs and on the tabBar Allow "closeable" for individual tabs #38
@@ -222,6 +222,9 @@ const TabBar = (props: TabBarProps) => { | |||
{tabList.map((child: any, i) => { | |||
const className = child.tabComponent.props.className; | |||
const activeClassName = child.tabComponent.props.classNameActive; | |||
const closeableTab = child.tabComponent.props.closeable |
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.
Why not use defaultProps?
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.
just missed it, definitely good to put it, in this case specifically, the props are inside the child component not on the parent itself, I defined the variables here for more readability when using it on the jsx after
@@ -232,7 +235,7 @@ const TabBar = (props: TabBarProps) => { | |||
onMouseUp={closeDragElement} | |||
> | |||
{child.tabComponent.props.tabHeader || child.tabComponent.props.text} | |||
{props.closeable && | |||
{ shouldClose && |
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.
extra space
@@ -9,6 +9,7 @@ export interface TabProps { | |||
text?: string; | |||
className?: string; | |||
classNameActive?: string; | |||
closeable?: boolean; |
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.
Add default props
@@ -31,7 +31,7 @@ const TabInterface = () => { | |||
</form> | |||
</Tab> | |||
|
|||
<Tab text="second tab" className="the-rest"> | |||
<Tab text="second tab" > |
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.
extra space
Please rebase this pull request |
@gustavoFreireS Could you review this PR again? |