Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gustavoFreireS
Copy link
Contributor

@davidcostadev davidcostadev changed the title close prop on tab and tabBar Close prop on tab and tabBar Aug 16, 2019
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use defaultProps?

Copy link
Contributor Author

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 &&
Copy link
Contributor

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;
Copy link
Contributor

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" >
Copy link
Contributor

Choose a reason for hiding this comment

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

extra space

@davidcostadev
Copy link
Contributor

Please rebase this pull request

@davidcostadev
Copy link
Contributor

@gustavoFreireS Could you review this PR again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants