Skip to content

Commit

Permalink
feat: hide close button for inactive tabs (Fixes graphql#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
morajabi committed Dec 3, 2017
1 parent 7341342 commit 897e62b
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/components/Playground/Tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ export default class Tab extends React.PureComponent<Props, State> {
.tab:hover {
@p: .bgDarkBlue;
}
.tab:hover :global(.close) {
opacity: 1;
}
.light.tab:hover {
background-color: #eeeff0;
}
Expand Down Expand Up @@ -120,12 +123,19 @@ export default class Tab extends React.PureComponent<Props, State> {
}
.close {
@p: .ml10, .o50, .relative;
@p: .ml10, .relative;
top: 1px;
height: 13px;
width: 13px;
opacity: 0;
&.active {
@p: .o100;
opacity: 1;
}
&.hasCircle {
opacity: 1;
}
}
Expand Down Expand Up @@ -196,7 +206,11 @@ export default class Tab extends React.PureComponent<Props, State> {
'New Tab'}
</div>
<div
className={`close ${index === selectedSessionIndex && 'active'}`}
className={`close${index === selectedSessionIndex ? ' active' : ''}${
session.isFile && session.hasChanged && !this.state.overCross
? ' hasCircle'
: ''
}`}
onClick={this.handleCloseSession}
onMouseEnter={this.handleMouseOverCross}
onMouseLeave={this.handleMouseOutCross}
Expand Down

0 comments on commit 897e62b

Please sign in to comment.