lmc-eu / spirit-design-system

Design system built by Alma Career (former LMC)
https://spirit.design
MIT License
23 stars 1 forks source link

React Tabs without TabsContent and Tab #364

Open literat opened 2 years ago

literat commented 2 years ago

I think that it is not necessary using Tab and TabsContent for a developer. Maybe the structure can be simplified to

<Tabs>
  <TabItem />
  <TabItem />
  <TabPane />
  <TabPane />
</Tabs>

ba using React.Children to parse children and sort them into items and panes arrays and then render in Tab wrapper and TabContent wrapper.

References:

adamkudrna commented 2 years ago

IMO, this is rather a halfway solution. I can imagine:

a) No magic:

<Tabs>
  <TabList>
    <TabItem />
    <TabItem />
  </TabList>
  <TabContent>
    <TabPane />
    <TabPane />
  </TabContent>
</Tabs>

b) Full magic:

<Tabs>
  <TabPane title="pane 1" active />
  <TabPane title="pane 2" />
</Tabs>

I think this is related to/duplicated by #365.