Skip to content
Open
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
43 changes: 29 additions & 14 deletions kolibri/plugins/learn/frontend/views/PrevNextBar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@
<div class="prev-next-bar">
<!-- Prev button on the left -->
<KButton
class="btn-flex"
appearance="flat-button"
data-testid="prev-button"
:style="{ gap: showButtonLabels ? '8px' : '0px' }"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a bit annoying but it's due to KButton internal <span>s being present even if empty, so the gaps would be rendered and the arrow off-center unless I cleared the gap value like this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: Pragmatic workaround for the KButton empty-span gap issue — the inline gap toggle keeps the icon centered without needing a wrapper element.

:disabled="!canGoPrev"
appearance="flat-button"
:aria-label="previousLabel$()"
:text="showButtonLabels ? previousLabel$() : ''"
@click="handlePrev"
>
<div class="btn-flex">
<template #icon>
<KIcon
class="icon"
icon="back"
class="btn-icon"
:color="$themeTokens.text"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: Nice use of $themeTokens.text and $themeTokens.textInverted for the icon colors — keeps theming consistent.

/>
<span v-if="showButtonLabels">{{ previousLabel$() }}</span>
</div>
</template>
</KButton>

<!-- Progress/status in the center -->
Expand All @@ -37,19 +40,22 @@
<slot name="actions"></slot>
</div>
<KButton
primary
class="btn-flex"
data-testid="next-button"
:style="{ gap: showButtonLabels ? '8px' : '0px' }"
:disabled="!canGoNext"
appearance="flat-button"
:aria-label="nextLabel$()"
:text="showButtonLabels ? nextLabel$() : ''"
@click="handleNext"
>
<div class="btn-flex">
<span v-if="showButtonLabels">{{ nextLabel$() }}</span>
<template #iconAfter>
<KIcon
class="icon"
class="btn-icon hotfixed"
icon="forward"
:color="$themeTokens.textInverted"
/>
</div>
</template>
</KButton>
</div>
</div>
Expand Down Expand Up @@ -168,12 +174,21 @@

.btn-flex {
display: flex;
gap: 4px;
align-items: center;
justify-content: center;

.icon {
top: 0;
padding: 8px;
font-weight: 600;
line-height: 135%;

.btn-icon {
top: -2px;
width: 16px;
height: 16px;

&.hotfixed {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: Good practice documenting the hotfix with a link to the upstream KDS PR — makes it easy to find and clean up later.

// Remove when https://github.com/learningequality/kolibri-design-system/pull/1219 is in KDS release
top: 0;
}
}
}

Expand Down
Loading