@@ -5,10 +5,7 @@ import { tokens } from '@equinor/eds-tokens';
55import { faker } from '@faker-js/faker' ;
66import { Meta , StoryFn , StoryObj } from '@storybook/react-vite' ;
77
8- import {
9- TableOfContents ,
10- TableOfContentsProps ,
11- } from 'src/organisms/TableOfContents/TableOfContents' ;
8+ import { TableOfContents } from 'src/organisms/TableOfContents/TableOfContents' ;
129import {
1310 TableOfContentsItemType ,
1411 TableOfContentsProvider ,
@@ -20,7 +17,12 @@ import styled from 'styled-components';
2017
2118const { colors } = tokens ;
2219
23- const meta : Meta = {
20+ type StoryProps = TableOfContentsProviderProps & {
21+ mode ?: 'vertical' | 'horizontal' ;
22+ onlyShowSelectedChildren ?: boolean ;
23+ } ;
24+
25+ const meta : Meta < StoryProps > = {
2426 title : 'Organisms/TableOfContents' ,
2527 component : TableOfContents ,
2628 parameters : {
@@ -32,7 +34,6 @@ const meta: Meta = {
3234 argTypes : {
3335 items : { control : 'object' } ,
3436 onlyShowSelectedChildren : { control : 'boolean' } ,
35- variant : { control : 'radio' , items : [ 'border' , 'buttons' ] } ,
3637 } ,
3738 args : {
3839 items : [
@@ -48,9 +49,20 @@ const meta: Meta = {
4849 label : 'Third section' ,
4950 value : 'id-3' ,
5051 } ,
52+ {
53+ label : 'Fourth section' ,
54+ value : 'id-4' ,
55+ } ,
56+ {
57+ label : 'Fifth section' ,
58+ value : 'id-5' ,
59+ } ,
60+ {
61+ label : 'Sixth section' ,
62+ value : 'id-6' ,
63+ } ,
5164 ] ,
5265 onlyShowSelectedChildren : false ,
53- variant : 'buttons' ,
5466 } ,
5567} ;
5668
@@ -118,6 +130,9 @@ const COLORS = [
118130 colors . infographic . substitute__blue_ocean . rgba ,
119131 colors . infographic . substitute__blue_sky . rgba ,
120132 colors . infographic . substitute__blue_overcast . rgba ,
133+ colors . infographic . substitute__green_cucumber . rgba ,
134+ colors . infographic . substitute__green_succulent . rgba ,
135+ colors . infographic . substitute__green_mint . rgba ,
121136] ;
122137
123138function Section ( {
@@ -141,8 +156,6 @@ function Section({
141156 ) ;
142157}
143158
144- type StoryProps = TableOfContentsProviderProps & TableOfContentsProps ;
145-
146159type Story = StoryObj < StoryProps > ;
147160
148161export const Default : Story = {
@@ -235,6 +248,33 @@ export const Horizontal: Story = {
235248 } ,
236249} ;
237250
251+ export const HorizontalScrollable : Story = {
252+ render : ( args ) => {
253+ return (
254+ < div style = { { width : '40rem' , maxWidth : '40rem' } } >
255+ < TableOfContentsProvider items = { args . items } >
256+ < HorizontalContainer >
257+ < TableOfContents
258+ mode = "horizontal"
259+ tabsProps = { { scrollable : true , amountPerScrollPage : 3 } }
260+ />
261+ < section >
262+ { args . items . map ( ( item , index ) => (
263+ < Section
264+ key = { item . value }
265+ label = { item . label }
266+ value = { item . value }
267+ color = { COLORS [ index ] }
268+ />
269+ ) ) }
270+ </ section >
271+ </ HorizontalContainer >
272+ </ TableOfContentsProvider >
273+ </ div >
274+ ) ;
275+ } ,
276+ } ;
277+
238278const ITEMS_WITH_CHILDREN : TableOfContentsItemType [ ] = [
239279 {
240280 label : '2023' ,
0 commit comments