idillon | 2ef2be9 | 2022-12-30 10:59:06 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2022 Savoir-faire Linux Inc. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU Affero General Public License as |
| 6 | * published by the Free Software Foundation; either version 3 of the |
| 7 | * License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU Affero General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Affero General Public |
| 15 | * License along with this program. If not, see |
| 16 | * <https://www.gnu.org/licenses/>. |
| 17 | */ |
idillon | 18283ac | 2023-01-07 12:06:42 -0500 | [diff] [blame] | 18 | import { |
| 19 | TabPanelUnstyled, |
| 20 | TabPanelUnstyledProps, |
| 21 | TabsListUnstyled, |
| 22 | TabsUnstyled, |
| 23 | TabsUnstyledProps, |
| 24 | TabUnstyled, |
| 25 | TabUnstyledProps, |
| 26 | } from '@mui/base'; |
idillon | 2ef2be9 | 2022-12-30 10:59:06 -0500 | [diff] [blame] | 27 | import { Theme } from '@mui/material/styles'; |
| 28 | import { styled } from '@mui/system'; |
| 29 | |
| 30 | type TabProps = TabUnstyledProps & { |
| 31 | theme?: Theme; |
| 32 | }; |
| 33 | |
| 34 | export const Tab = styled(TabUnstyled)<TabProps>(({ theme }) => ({ |
| 35 | fontFamily: theme.typography.fontFamily, |
| 36 | ...theme.typography.body1, |
| 37 | color: '#666666', |
| 38 | cursor: 'pointer', |
| 39 | border: 'none', |
| 40 | display: 'flex', |
| 41 | justifyContent: 'center', |
| 42 | borderBottom: '4px solid white', |
| 43 | backgroundColor: 'white', |
| 44 | padding: '9px 0', |
| 45 | '&:hover': { |
| 46 | color: 'black', |
| 47 | borderColor: theme.palette.primary.light, |
| 48 | // Attempt to change boldess while keeping same container size |
| 49 | // https://stackoverflow.com/a/14978871 |
| 50 | textShadow: '0 0 .01px black', |
| 51 | }, |
| 52 | '&.Mui-selected': { |
| 53 | color: theme.palette.primary.dark, |
| 54 | borderColor: theme.palette.primary.dark, |
| 55 | // https://stackoverflow.com/a/14978871 |
| 56 | textShadow: `0 0 .01px ${theme.palette.primary.dark}`, |
| 57 | }, |
| 58 | '&:before': { |
| 59 | display: 'block', |
| 60 | content: 'attr(content)', |
| 61 | fontWeight: 'bold', |
| 62 | height: '15px', |
| 63 | color: 'transparent', |
| 64 | overflow: 'hidden', |
| 65 | visibility: 'hidden', |
| 66 | }, |
| 67 | })); |
| 68 | |
idillon | 18283ac | 2023-01-07 12:06:42 -0500 | [diff] [blame] | 69 | export type TabPanelProps = TabPanelUnstyledProps; |
| 70 | |
idillon | 2ef2be9 | 2022-12-30 10:59:06 -0500 | [diff] [blame] | 71 | export const TabPanel = styled(TabPanelUnstyled)(() => ({ |
| 72 | width: '100%', |
| 73 | })); |
| 74 | |
| 75 | export const TabsList = styled(TabsListUnstyled)(() => ({ |
| 76 | display: 'flex', |
| 77 | alignItems: 'center', |
| 78 | placeContent: 'space-evenly', |
| 79 | borderBottom: '1px solid #bfbfbf', |
| 80 | })); |
| 81 | |
idillon | 18283ac | 2023-01-07 12:06:42 -0500 | [diff] [blame] | 82 | export type TabsProps = TabsUnstyledProps; |
| 83 | |
idillon | 2ef2be9 | 2022-12-30 10:59:06 -0500 | [diff] [blame] | 84 | export const Tabs = TabsUnstyled; |