Skip to content

Commit

Permalink
Merge pull request #330 from bethinkpl/IT-5219_outline_item_alignment…
Browse files Browse the repository at this point in the history
…_fix

IT-5219 OutlineItem has different alignment depending on default slot length
  • Loading branch information
pioziol123 authored Jan 11, 2024
2 parents 0a86a9e + 126db6d commit 6bf5a19
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
18 changes: 10 additions & 8 deletions lib/js/components/Outline/OutlineItem/OutlineItem.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ const StoryTemplate: StoryFn<typeof OutlineItem> = (args) => ({
};
},
template: `
<outline-item :label="label" :additional-text="additionalText" :size="size" :state="state"
:icon-left="ICONS[iconLeft]" :icon-right="ICONS[iconRight]" :is-done="isDone"
:is-selected="isSelected" :background-color="backgroundColor" :index="index"
:is-label-uppercase="isLabelUppercase" :icon-right-rotation="iconRightRotation"
:has-selected-icons-color-primary="hasSelectedIconsColorPrimary"
:is-selected-interactive="isSelectedInteractive">
<ds-pill v-if="defaultSlot.length > 0" :label="defaultSlot" />
</outline-item>`,
<outline-item :label="label" :additional-text="additionalText" :size="size" :state="state"
:icon-left="ICONS[iconLeft]" :icon-right="ICONS[iconRight]" :is-done="isDone"
:is-selected="isSelected" :background-color="backgroundColor" :index="index"
:is-label-uppercase="isLabelUppercase" :icon-right-rotation="iconRightRotation"
:has-selected-icons-color-primary="hasSelectedIconsColorPrimary"
:is-selected-interactive="isSelectedInteractive">
<template #default v-if="defaultSlot.length > 0">
<ds-pill :label="defaultSlot" />
</template>
</outline-item>`,
});

export const Interactive = StoryTemplate.bind({});
Expand Down
10 changes: 7 additions & 3 deletions lib/js/components/Outline/OutlineItem/OutlineItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'-backgroundNeutral': backgroundColor === OUTLINE_ITEM_BACKGROUND_COLORS.NEUTRAL,
}"
>
<div class="outlineItem__content">
<div class="outlineItem__content" :class="{ '-centeredContent': $slots.default }">
<span
v-if="index !== null"
class="outlineItem__index"
Expand All @@ -35,7 +35,7 @@
</span>
</span>
</div>
<div class="outlineItem__rightContent">
<div class="outlineItem__rightContent" :class="{ '-centeredContent': $slots.default }">
<template v-if="$slots.default">
<slot />
</template>
Expand Down Expand Up @@ -78,9 +78,13 @@
&__rightContent,
&__content {
align-items: center;
align-items: flex-start;
column-gap: $space-xxs;
display: flex;
&.-centeredContent {
align-items: center;
}
}
&__index {
Expand Down

0 comments on commit 6bf5a19

Please sign in to comment.