Skip to content

Commit

Permalink
Fix chipgroup spacing (#1730)
Browse files Browse the repository at this point in the history
* Fix chipgroup spacing

The spacing was originally around items, rather than between items. Now that FlowRow added support for spacing between items we can correct the component and only apply spacing between items.

* Updated snapshots for 'default'

* Updated snapshots for 'rtl'

* Updated snapshots for 'dm'

* Trigger CI

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
Maria Neumayer and github-actions[bot] authored Sep 20, 2023
1 parent 673ecc9 commit 3b735c7
Show file tree
Hide file tree
Showing 63 changed files with 10 additions and 8 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ package net.skyscanner.backpack.compose.chipgroup.multiple.internal
import androidx.compose.foundation.LocalIndication
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.height
Expand Down Expand Up @@ -69,13 +69,13 @@ internal fun BpkMultiSelectChipGroupImpl(
LazyRow(
modifier = Modifier.selectableGroup(),
state = rememberLazyListState(),
horizontalArrangement = Arrangement.spacedBy(BpkSpacing.Md),
) {
items(items = chips) { chip ->
ChipItem(
chip = chip,
style = style,
modifier = Modifier
.padding(PaddingValues(BpkSpacing.Sm))
.semantics { role = Role.Checkbox },)
}
}
Expand All @@ -85,13 +85,14 @@ internal fun BpkMultiSelectChipGroupImpl(
BpkMultiChipGroupType.Wrap -> {
FlowRow(
modifier = modifier.selectableGroup(),
horizontalArrangement = Arrangement.spacedBy(BpkSpacing.Md),
verticalArrangement = Arrangement.spacedBy(BpkSpacing.Md),
) {
chips.forEach { chip ->
ChipItem(
chip = chip,
style = style,
modifier = Modifier
.padding(PaddingValues(BpkSpacing.Sm))
.semantics { role = Role.Checkbox },)
}
}
Expand All @@ -108,12 +109,12 @@ private fun StickyChip(
val interactionSource = remember { MutableInteractionSource() }
Row(
modifier = modifier
.padding(PaddingValues(BpkSpacing.Sm))
.padding(end = BpkSpacing.Md)
.height(IntrinsicSize.Min),
) {
BpkChipImpl(
modifier = Modifier
.padding(PaddingValues(end = BpkSpacing.Md))
.padding(end = BpkSpacing.Md)
.semantics {
role = Role.Button
contentDescription = chip.text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@

package net.skyscanner.backpack.compose.chipgroup.single.internal

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.lazy.rememberLazyListState
Expand Down Expand Up @@ -52,6 +51,7 @@ internal fun BpkSingleSelectChipGroupImpl(
LazyRow(
modifier = modifier.selectableGroup(),
state = rememberLazyListState(),
horizontalArrangement = Arrangement.spacedBy(BpkSpacing.Md),
) {
itemsIndexed(items = chips) { index, chip ->
ChipItem(chip, index == selectedIndex, style) {
Expand All @@ -64,6 +64,8 @@ internal fun BpkSingleSelectChipGroupImpl(
BpkSingleChipGroupType.Wrap -> {
FlowRow(
modifier = modifier.selectableGroup(),
horizontalArrangement = Arrangement.spacedBy(BpkSpacing.Md),
verticalArrangement = Arrangement.spacedBy(BpkSpacing.Md),
) {
chips.forEachIndexed { index, chip ->
ChipItem(chip, index == selectedIndex, style) {
Expand All @@ -85,7 +87,6 @@ private fun ChipItem(
) {
BpkChip(
modifier = modifier
.padding(PaddingValues(BpkSpacing.Sm))
.semantics { role = Role.RadioButton },
text = chip.text,
icon = chip.icon,
Expand Down
Binary file modified docs/compose/Chip/screenshots/default.png
Binary file modified docs/compose/Chip/screenshots/default_dm.png
Binary file modified docs/compose/Chip/screenshots/on-dark.png
Binary file modified docs/compose/Chip/screenshots/on-dark_dm.png
Binary file modified docs/compose/Chip/screenshots/on-image.png
Binary file modified docs/compose/Chip/screenshots/on-image_dm.png
Binary file modified docs/compose/ChipGroup/screenshots/multi-select-rail.png
Binary file modified docs/compose/ChipGroup/screenshots/multi-select-rail_dm.png
Binary file modified docs/compose/ChipGroup/screenshots/multi-select-wrap.png
Binary file modified docs/compose/ChipGroup/screenshots/multi-select-wrap_dm.png
Binary file modified docs/compose/ChipGroup/screenshots/single-select-rail.png
Binary file modified docs/compose/ChipGroup/screenshots/single-select-rail_dm.png
Binary file modified docs/compose/ChipGroup/screenshots/single-select-wrap.png
Binary file modified docs/compose/ChipGroup/screenshots/single-select-wrap_dm.png

0 comments on commit 3b735c7

Please sign in to comment.