Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace TabsWithOverflow with KListWithOverflow #12035

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion kolibri/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"js-cookie": "^3.0.5",
"knuth-shuffle-seeded": "^1.0.6",
"kolibri-constants": "0.2.5",
"kolibri-design-system": "3.0.1",
"kolibri-design-system": "3.1.1",
"lockr": "0.8.5",
"lodash": "^4.17.21",
"loglevel": "^1.9.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,49 +39,42 @@
:layout8="{ span: 6 }"
:layout12="{ span: 10 }"
>
<TabsWithOverflow
<KListWithOverflow
Copy link
Member

Choose a reason for hiding this comment

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

When I tested it I noticed we're missing the styles and click-ability of the section buttons. I believe this is because the TabsWithOverflow component wrapped everything within a KTabsList.

I think that you'll need to still migrate some of that logic to this component - such as the "activeTabId" and "@click" handler and possibly the "tabsWrapper" ref.

I think that it may work by wrapping the whole <template #item="{ item }"> block with the KTabsList component without worrying about the #tab slot there -- but I'm not super sure on this.

tabsId="quizSectionTabs"
class="section-tabs"
:tabs="tabs"
:activeTabId="activeSection ?
activeSection.section_id :
'' "
backgroundColor="transparent"
hoverBackgroundColor="transparent"
:aria-label="quizSectionsLabel$()"
@click="id => setActiveSection(id)"
:items="tabs"
>
<template #tab="{ tab }">
<template #item="{ item }">
<span
:ref="tabRefLabel(tab.id)"
:ref="tabRefLabel(item.id)"
appearance="flat-button"
style="display: inline-block;"
:appearanceOverrides="tabStyles"
>
{{ tab.label }}
{{ item.label }}
</span>
</template>

<template #overflow="{ overflowTabs }">
<template #more="{ overflowItems }">
<KIconButton
v-if="overflowTabs.length"
v-if="overflowItems.length"
tabindex="-1"
class="overflow-tabs"
icon="optionsHorizontal"
:style="overflowButtonStyles(overflowTabs)"
:style="overflowButtonStyles(overflowItems)"
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if the overflowItems given by the new KListWithOverflow are the same shape as the data we were getting before because of the missing styles -- however, this may only be due to the missing KTabsList component issue mentioned above.

>
<template #menu>
<KDropdownMenu
:primary="false"
:disabled="false"
:hasIcons="true"
:options="overflowTabs"
:options="overflowItems"
@select="opt => setActiveSection(opt.id)"
/>
</template>
</KIconButton>
</template>
</TabsWithOverflow>
</KListWithOverflow>
</KGridItem>

<KGridItem
Expand Down Expand Up @@ -330,10 +323,10 @@
import DragHandle from 'kolibri.coreVue.components.DragHandle';
import DragSortWidget from 'kolibri.coreVue.components.DragSortWidget';
import Draggable from 'kolibri.coreVue.components.Draggable';
import KListWithOverflow from 'kolibri-design-system/lib/KListWithOverflow';
import { injectQuizCreation } from '../../../composables/useQuizCreation';
import commonCoach from '../../common';
import { PageNames } from '../../../constants';
import TabsWithOverflow from './TabsWithOverflow';
import AccordionContainer from './AccordionContainer';
import AccordionItem from './AccordionItem';

Expand All @@ -348,7 +341,7 @@
Draggable,
DragSortWidget,
DragHandle,
TabsWithOverflow,
KListWithOverflow,
},
mixins: [commonCoreStrings, commonCoach],
setup() {
Expand Down
2 changes: 1 addition & 1 deletion packages/kolibri-core-for-export/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"js-cookie": "^3.0.5",
"knuth-shuffle-seeded": "^1.0.6",
"kolibri-constants": "0.2.5",
"kolibri-design-system": "3.0.1",
"kolibri-design-system": "3.1.1",
"lockr": "0.8.5",
"lodash": "^4.17.21",
"loglevel": "^1.9.1",
Expand Down
17 changes: 13 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2376,6 +2376,15 @@ aphrodite@1.1.0:
asap "^2.0.3"
inline-style-prefixer "^2.0.0"

"aphrodite@git+https://github.com/learningequality/aphrodite.git":
version "2.2.3"
uid fdc8d7be8912a5cf17f74ff10f124013c52c3e32
resolved "git+https://github.com/learningequality/aphrodite.git#fdc8d7be8912a5cf17f74ff10f124013c52c3e32"
dependencies:
asap "^2.0.3"
inline-style-prefixer "^4.0.2"
string-hash "^1.1.3"

"aphrodite@https://github.com/learningequality/aphrodite/":
version "2.2.3"
resolved "https://github.com/learningequality/aphrodite/#fdc8d7be8912a5cf17f74ff10f124013c52c3e32"
Expand Down Expand Up @@ -7758,10 +7767,10 @@ kolibri-constants@0.2.5:
resolved "https://registry.yarnpkg.com/kolibri-constants/-/kolibri-constants-0.2.5.tgz#2b9df4c477119d0ade2d66bf8aef8a4172f0418f"
integrity sha512-ZoFZ83xgteZhFZtYjiOmITcZeSF+X42i12TOo87zmcdA78jj0dZbPYB+ttO855UxoKY8h4HHeDVZIUkE5TGa5g==

kolibri-design-system@3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/kolibri-design-system/-/kolibri-design-system-3.0.1.tgz#ba6368c78ffab1d6195b828b1aacc4f11b9a67c3"
integrity sha512-/O+KuYTGiv5z9VTlm8bIWZwanMdearGmIP162EqaVn2tIbo/hY42lsuAbGSTZPi5CITm+LJ9r99ogImDRH8z2w==
kolibri-design-system@3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/kolibri-design-system/-/kolibri-design-system-3.1.1.tgz#f140b5732d57432eb6ac02af6a01ba00d227eedf"
integrity sha512-cqC3J0ztp2VpGjrs4G0ujgxVYFQb96BXnfqiYg/mmmOVd+mSA2ci3dCFUKYXRtFZQswcLAL2XeaFg0aWpqVdXg==
dependencies:
"@vue/composition-api" "^1.7.2"
aphrodite "https://github.com/learningequality/aphrodite/"
Expand Down