Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jlpereira committed Mar 15, 2023
1 parent bd8c562 commit ce708e1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

<script setup>
import { ref, computed } from 'vue'
import { useSplitList } from './useSplitList'
import { splitList } from './splitList'
import CitationRow from './PanelCitationRow.vue'
import PanelNomenclatureShowMore from './PanelNomenclatureShowMore.vue'
Expand All @@ -56,7 +56,7 @@ const props = defineProps({
})
const showAll = ref(false)
const citationList = useSplitList(props, MAX_CITATIONS)
const citationList = computed(() => splitList(props.list, MAX_CITATIONS))
const menuOptions = computed(() => [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

<script setup>
import { computed, ref } from 'vue'
import { useSplitList } from './useSplitList'
import { splitList } from './splitList'
import PanelNomenclatureShowMore from './PanelNomenclatureShowMore.vue'
import PanelReferenceRow from './PanelReferenceRow.vue'
Expand All @@ -56,7 +56,7 @@ const props = defineProps({
})
const showAll = ref(false)
const referenceList = useSplitList(props, MAX_REFERENCES)
const referenceList = computed(() => splitList(props.list, MAX_REFERENCES))
const menuOptions = computed(() => [
{
Expand Down
14 changes: 14 additions & 0 deletions src/modules/otus/components/Panel/PanelNomenclature/splitList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { computed } from 'vue'

export function splitList(list, MAX_RECORDS) {
const copyArr = list.slice()
const first = copyArr.splice(0, MAX_RECORDS)
const last = copyArr.splice(-MAX_RECORDS)
const middle = copyArr

return {
first,
middle,
last
}
}

This file was deleted.

0 comments on commit ce708e1

Please sign in to comment.