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

BREAKING(Tab): allow right/left without tabular #2265

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/modules/Tab/Tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Tab extends Component {

static defaultProps = {
grid: { paneWidth: 12, tabWidth: 4 },
menu: { attached: true, tabular: true },
menu: { attached: true, tabular: true, aligned: 'left' },
renderActiveOnly: true,
}

Expand Down Expand Up @@ -124,13 +124,13 @@ class Tab extends Component {

return (
<Grid {...gridProps}>
{menu.props.tabular !== 'right' && GridColumn.create({ width: tabWidth, children: menu })}
{menu.props.aligned !== 'right' && GridColumn.create({ width: tabWidth, children: menu })}
{GridColumn.create({
width: paneWidth,
children: this.renderItems(),
stretched: true,
})}
{menu.props.tabular === 'right' && GridColumn.create({ width: tabWidth, children: menu })}
{menu.props.aligned === 'right' && GridColumn.create({ width: tabWidth, children: menu })}
</Grid>
)
}
Expand Down
8 changes: 4 additions & 4 deletions test/specs/modules/Tab/Tab-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ describe('Tab', () => {
]

describe('menu', () => {
it('defaults to an attached tabular menu', () => {
it('defaults to an attached left aligned tabular menu', () => {
Tab.defaultProps
.should.have.property('menu')
.which.deep.equals({ attached: true, tabular: true })
.which.deep.equals({ attached: true, tabular: true, aligned: 'left' })
})

it('passes the props to the Menu', () => {
Expand Down Expand Up @@ -54,8 +54,8 @@ describe('Tab', () => {
wrapper.childAt(1).should.match('Menu')
})

it("renders right of the pane when tabular='right'", () => {
const wrapper = shallow(<Tab menu={{ fluid: true, vertical: true, tabular: 'right' }} panes={panes} />)
it("renders right of the pane when aligned='right'", () => {
const wrapper = shallow(<Tab menu={{ fluid: true, vertical: true, aligned: 'right' }} panes={panes} />)

wrapper.childAt(0).should.match('Grid')
wrapper.childAt(0).shallow().childAt(0).should.match('GridColumn')
Expand Down