-
Notifications
You must be signed in to change notification settings - Fork 843
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Condensed Display Prop for EuiTabs & EuiTabbedContent (#1904)
* initial props, style and test additions * css alpha rules ocd * update snapshots * added prop description * add display prop to tabbed_content * update changelog * comments and desc updates * added carolines suggested docs changes * rm extraneous div * add prop to ts defs * add example snippets * change div to fragment * update tests and snapshots * correct misplaced description * switch from complex not selector to overrides * add missing EuiTab props, update snippets
- Loading branch information
1 parent
4b32e06
commit 55330de
Showing
12 changed files
with
454 additions
and
206 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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,61 @@ | ||
import React, { Component } from 'react'; | ||
|
||
import { EuiTabs, EuiTab } from '../../../../src/components'; | ||
|
||
class EuiTabsExample extends Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.tabs = [ | ||
{ | ||
id: 'cobalt', | ||
name: 'Cobalt', | ||
disabled: false, | ||
}, | ||
{ | ||
id: 'dextrose', | ||
name: 'Dextrose', | ||
disabled: false, | ||
}, | ||
{ | ||
id: 'hydrogen', | ||
name: 'Hydrogen', | ||
disabled: true, | ||
}, | ||
{ | ||
id: 'monosodium_glutammate', | ||
name: 'Monosodium Glutamate', | ||
disabled: false, | ||
}, | ||
]; | ||
|
||
this.state = { | ||
selectedTabId: 'cobalt', | ||
}; | ||
} | ||
|
||
onSelectedTabChanged = id => { | ||
this.setState({ | ||
selectedTabId: id, | ||
}); | ||
}; | ||
|
||
renderTabs() { | ||
return this.tabs.map((tab, index) => ( | ||
<EuiTab | ||
onClick={() => this.onSelectedTabChanged(tab.id)} | ||
isSelected={tab.id === this.state.selectedTabId} | ||
disabled={tab.disabled} | ||
key={index} | ||
> | ||
{tab.name} | ||
</EuiTab> | ||
)); | ||
} | ||
|
||
render() { | ||
return <EuiTabs display="condensed">{this.renderTabs()}</EuiTabs>; | ||
} | ||
} | ||
|
||
export default EuiTabsExample; |
This file contains 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
This file contains 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
Oops, something went wrong.