Skip to content

Commit

Permalink
feat(menu): wrapping variant
Browse files Browse the repository at this point in the history
Added a wrapping variant for menu just like we already implemented for a button group
Optional wrapped class adjusts border radius (just as in button group)
enhanced centered to work together with fluid to allow centered menu items which stay inside a full width fluid menu (works great with wrapping :)
  • Loading branch information
lubber-de authored Feb 2, 2023
1 parent 3b0a796 commit cf51e1c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
40 changes: 37 additions & 3 deletions src/definitions/collections/menu.less
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ Floated Menu / Item
.ui.compact.menu .item:last-child {
border-radius: 0 @borderRadius @borderRadius 0;
}
.ui.pagination.menu .item:last-child::before {
.ui.pagination.menu:not(.wrapping) .item:last-child::before {
display: none;
}

Expand Down Expand Up @@ -1489,12 +1489,17 @@ Floated Menu / Item
}

& when (@variationMenuCentered) {
.ui.center.aligned.menu,
.ui.centered.menu {
.ui.center.aligned.menu:not(.fluid),
.ui.centered.menu:not(.fluid) {
display: inline-flex;
transform: translateX(-50%);
margin-left: 50%;
}
.ui.center.aligned.menu .item,
.ui.centered.menu .item {
flex: 1 0 auto;
justify-content: center;
}
}

& when (@variationMenuInverted) {
Expand Down Expand Up @@ -1914,6 +1919,35 @@ Floated Menu / Item
}
}

& when (@variationMenuWrapping) {
.ui.wrapping.menu {
flex-wrap: wrap;
& .item::before {
right: auto;
left: 0;
}
& .item:first-child::before {
display: none;
}
&:not(.tabular) .item {
&:last-of-type,
&:last-child {
border-right: @dividerSize solid @dividerBackground;
}
}
}
& when (@variationMenuWrapped) {
.ui.wrapped.menu:not(.tabular) .item {
&:first-child {
border-bottom-left-radius: 0;
}
&:last-child {
border-top-right-radius: 0;
}
}
}
}

/* --------------
Sizes
--------------- */
Expand Down
2 changes: 2 additions & 0 deletions src/themes/default/globals/variation.variables
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@
@variationMenuAttached: true;
@variationMenuIcon: true;
@variationMenuEqualWidth: true;
@variationMenuWrapping: true;
@variationMenuWrapped: true;
@variationMenuSizes: @variationAllSizes;
@variationMenuColors: @variationAllColors;

Expand Down

0 comments on commit cf51e1c

Please sign in to comment.