import { Tabs } from '@based/ui'
import { useState } from 'react'

export const meta: Based.UI.Extractor.MetaDescriptor = {
  name: 'Tabs',
  group: 'Interactables',
  section: 'components',
  icon: 'edit',
  component: Tabs,
  subtitle:
    'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
  showApi: true,
  showUsage: true,
}

export const blocks: Based.UI.Extractor.BlocksDescriptor[] = [
  {
    name: 'Default',
    type: 'component',
    description: 'Et harum quidem rerum facilis est et expedita distinctio.',
    style: {
      size: 'small',
      frame: false,
      flex: {
        justifyContent: 'center',
        alignItems: 'center',
      },
    },
    render: () => {
      const [value, setValue] = useState('all')

      return (
        <Tabs
          value={value}
          onChange={setValue}
          tabs={[
            { value: 'all', label: 'All' },
            { value: 'article', label: 'Article' },
            { value: 'category', label: 'Categories' },
            { value: 'author', label: 'Authors' },
            { value: 'access', label: 'Access' },
            { value: 'engagement', label: 'Engagement' },
          ]}
        />
      )
    },
  },
]
