Skip to content
Merged
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
10 changes: 8 additions & 2 deletions theme/src/components/variant-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@

import React from 'react';
import styled from 'styled-components';
import { Dropdown } from '@primer/components';
import { Dropdown, themeGet } from '@primer/components';
import NavHierarchy from '../nav-hierarchy'

VariantSelect.Menu = styled(Dropdown.Menu)`
width: ${props => props.width ? props.width : '160px'};
`

VariantSelect.Button = styled(Dropdown.Button)`
&:focus {
box-shadow: 0 0 0 3px ${themeGet('colors.blue.5')};
}
`

function VariantSelect(props) {
const path = NavHierarchy.getPath(props.location.pathname);
const vp = NavHierarchy.getVariantAndPage(props.root, path);
Expand Down Expand Up @@ -67,7 +73,7 @@ function VariantSelect(props) {

return (
<Dropdown onKeyDown={onDropDownKeyDown} overlay={props.overlay}>
<Dropdown.Button>{selectedItem.variant.title}</Dropdown.Button>
<VariantSelect.Button>{selectedItem.variant.title}</VariantSelect.Button>
<VariantSelect.Menu direction={props.direction} width={props.menuWidth}>
{items}
</VariantSelect.Menu>
Expand Down