Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Resolve #135: Added dropup on dropdown #137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion src/components/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ export interface Dropdown<T> extends Bulma.Active, Bulma.Alignment, Bulma.Tag, R
isActive?: boolean;
isAlign?: 'right';
isHoverable?: boolean;
isDropup?: boolean;
}

export function Dropdown({ tag = 'div', isHoverable, ...props }: Dropdown<HTMLElement>) {
export function Dropdown({ tag = 'div', isHoverable, isDropup, ...props }: Dropdown<HTMLElement>) {
const className = classNames(
'dropdown',
{
'is-hoverable': isHoverable,
'is-up': isDropup,
...combineModifiers(props, getActiveModifiers, getAlignmentModifiers),
},
props.className,
Expand Down
7 changes: 7 additions & 0 deletions test/components/Dropdown/Dropdown.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,11 @@ describe('Dropdown', () => {
expect(component.hasClass('is-hoverable')).toBe(true);
expect(component.hasClass('is-right')).toBe(true);
});

it('should make dropdown dropup', () => {
const component = shallow(<Dropdown isDropup isAlign="right" isHoverable>My Dropdown</Dropdown>);
expect(component.hasClass('dropdown')).toBe(true);
expect(component.hasClass('is-hoverable')).toBe(true);
expect(component.hasClass('is-up')).toBe(true);
});
});