@chakra-ui/core#Tab JavaScript Examples

The following examples show how to use @chakra-ui/core#Tab. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.js    From here-covid-19-tracker with MIT License 6 votes vote down vote up
DataTypeSwitch = ({ rows }) => {
  const updateDataType = useDataTypeStore(state => state.updateDataType)
  const handleTabChange = (val) => {
    updateDataType(val)
  }
  return (
    <Tabs variantColor="orange" mt="1.25rem" onChange={handleTabChange}>
      <TabList>
        <Tab width={1/3} justifyContent="flex-start" pl="1.25rem" color="gray.600" _selected={{ borderColor: "#ec610e", color: "#ec610e" }}>
          <Box textAlign="left">
            <SumStat points={rows} prefix="" text="Confirmed" />
          </Box>
        </Tab>
        <Tab width={1/3} justifyContent="flex-start" pl="1.25rem" color="gray.600" _selected={{ borderColor: "#ec610e", color: "#ec610e" }}>
          <Box textAlign="left">
            <SumStat points={rows} prefix="deaths_" text="Deaths" />
          </Box>
        </Tab>
        <Tab width={1/3} justifyContent="flex-start" pl="1.25rem" color="gray.600" _selected={{ borderColor: "#ec610e", color: "#ec610e" }}>
          <Box textAlign="left">
            <SumStat points={rows} prefix="recoveries_" text="Recoveries" />
          </Box>
        </Tab>
      </TabList>
    </Tabs>
  )
}
Example #2
Source File: index.js    From here-covid-19-tracker with MIT License 6 votes vote down vote up
NavigationTabs = () => {
  const updateTab = useTabStore(state => state.updateTab)
  const currentTab = useTabStore(state => state.currentTab)

  const handleTabChange = index => {
    updateTab(index)
  }

  return (
    <Box
      display={["block", null, "none"]}
      position="fixed"
      bottom="0"
      left="0"
      right="0"
      bg="white"
      zIndex={999999}
      boxShadow="0 -0.25rem 0.75rem rgba(0,0,0,0.1)"
    >
      <Tabs variantColor="orange" onChange={handleTabChange} defaultIndex={1} index={currentTab}>
        <TabList display="flex" justifyContent="space-between">
          <Tab width={1/3} height="3rem" fontWeight={600} _focus={{ boxShadow: "none" }}>
            <Icon name="list" mr="0.25rem"/>
            { "Cases" }
          </Tab>
          <Tab width={1/3} height="3rem" fontWeight={600} _focus={{ boxShadow: "none" }}>
            <Icon name="globe" mr="0.25rem"/>
            { "Map" }
          </Tab>
          <Tab width={1/3} height="3rem" fontWeight={600} _focus={{ boxShadow: "none" }}>
            <Icon name="info" mr="0.25rem"/>
            { "About" }
          </Tab>
        </TabList>
      </Tabs>
    </Box>
  )
}