blob: 7e7f3b2c5538a79007ea08562a4a4a5adcea8c91 [file] [log] [blame]
idillon2ef2be92022-12-30 10:59:06 -05001/*
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 */
idillon18283ac2023-01-07 12:06:42 -050018import {
19 TabPanelUnstyled,
20 TabPanelUnstyledProps,
21 TabsListUnstyled,
22 TabsUnstyled,
23 TabsUnstyledProps,
24 TabUnstyled,
25 TabUnstyledProps,
26} from '@mui/base';
idillon2ef2be92022-12-30 10:59:06 -050027import { Theme } from '@mui/material/styles';
28import { styled } from '@mui/system';
29
30type TabProps = TabUnstyledProps & {
31 theme?: Theme;
32};
33
34export 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
idillon18283ac2023-01-07 12:06:42 -050069export type TabPanelProps = TabPanelUnstyledProps;
70
idillon2ef2be92022-12-30 10:59:06 -050071export const TabPanel = styled(TabPanelUnstyled)(() => ({
72 width: '100%',
73}));
74
75export const TabsList = styled(TabsListUnstyled)(() => ({
76 display: 'flex',
77 alignItems: 'center',
78 placeContent: 'space-evenly',
79 borderBottom: '1px solid #bfbfbf',
80}));
81
idillon18283ac2023-01-07 12:06:42 -050082export type TabsProps = TabsUnstyledProps;
83
idillon2ef2be92022-12-30 10:59:06 -050084export const Tabs = TabsUnstyled;