@campxdev/shared 1.5.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { Search } from '@mui/icons-material'
|
|
2
2
|
import { InputAdornment } from '@mui/material'
|
|
3
3
|
import _ from 'lodash'
|
|
4
|
-
import { useMemo, useState } from 'react'
|
|
4
|
+
import { ReactNode, useMemo, useState } from 'react'
|
|
5
5
|
import { TextField } from '../Input'
|
|
6
6
|
import { ITextFieldProps } from '../Input/TextField'
|
|
7
7
|
|
|
8
8
|
interface SearchBarProps {
|
|
9
9
|
onSearch: (v: string) => void
|
|
10
|
+
label?: ReactNode
|
|
10
11
|
textFieldProps?: ITextFieldProps
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
export default function SearchBar({
|
|
14
|
+
export default function SearchBar({
|
|
15
|
+
onSearch,
|
|
16
|
+
label,
|
|
17
|
+
...restProps
|
|
18
|
+
}: SearchBarProps) {
|
|
14
19
|
const [, setSearch] = useState('')
|
|
15
20
|
|
|
16
21
|
const debouncedChangeHandler = useMemo(
|
|
@@ -24,7 +29,7 @@ export default function SearchBar({ onSearch, ...restProps }: SearchBarProps) {
|
|
|
24
29
|
|
|
25
30
|
return (
|
|
26
31
|
<TextField
|
|
27
|
-
label=
|
|
32
|
+
label={label}
|
|
28
33
|
placeholder="Search"
|
|
29
34
|
onChange={debouncedChangeHandler}
|
|
30
35
|
InputProps={{
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Box, BoxProps, styled, Typography } from '@mui/material'
|
|
2
|
+
import { NavLink } from 'react-router-dom'
|
|
3
|
+
|
|
4
|
+
interface TabsContainerProps {
|
|
5
|
+
tabs: {
|
|
6
|
+
label: string
|
|
7
|
+
path: string
|
|
8
|
+
}[]
|
|
9
|
+
size?: 'small' | 'medium'
|
|
10
|
+
center?: boolean
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const StyledTabsWrapper = styled(Box)<{
|
|
14
|
+
size: 'small' | 'medium'
|
|
15
|
+
center
|
|
16
|
+
}>(({ theme, size, center }) => ({
|
|
17
|
+
justifyContent: center ? 'center' : 'flex-start',
|
|
18
|
+
borderBottom: theme.borders.grayLight,
|
|
19
|
+
minHeight: size === 'small' ? '48px' : '60px',
|
|
20
|
+
display: 'flex',
|
|
21
|
+
width: '100%',
|
|
22
|
+
gap: '5px',
|
|
23
|
+
gapY: '20px',
|
|
24
|
+
alignItems: 'end',
|
|
25
|
+
paddingLeft: '20px',
|
|
26
|
+
flexWrap: 'wrap',
|
|
27
|
+
'& a': {
|
|
28
|
+
display: 'block',
|
|
29
|
+
textDecoration: 'none',
|
|
30
|
+
fontSize: size === 'small' ? '14px' : '15px',
|
|
31
|
+
fontWeight: 600,
|
|
32
|
+
color: theme.palette.secondary.main,
|
|
33
|
+
},
|
|
34
|
+
}))
|
|
35
|
+
|
|
36
|
+
const StyledTab = styled(
|
|
37
|
+
(props: BoxProps) => (
|
|
38
|
+
<Box {...props}>
|
|
39
|
+
<Typography variant="h6" fontSize={16}>
|
|
40
|
+
{props.children}
|
|
41
|
+
</Typography>
|
|
42
|
+
<span className="indicator"></span>
|
|
43
|
+
</Box>
|
|
44
|
+
),
|
|
45
|
+
{ shouldForwardProp: (prop) => prop !== 'active' },
|
|
46
|
+
)<{ active: boolean }>(({ theme, active }) => ({
|
|
47
|
+
paddingRight: '24px',
|
|
48
|
+
paddingBottom: '0',
|
|
49
|
+
transition: 'all 0.4s ease',
|
|
50
|
+
'& .indicator': {
|
|
51
|
+
display: 'block',
|
|
52
|
+
background: theme.palette.common.yellow,
|
|
53
|
+
visibility: 'hidden',
|
|
54
|
+
height: '3px',
|
|
55
|
+
width: '70%',
|
|
56
|
+
borderRadius: '2px',
|
|
57
|
+
marginTop: '3px',
|
|
58
|
+
...(active && {
|
|
59
|
+
visibility: 'visible',
|
|
60
|
+
}),
|
|
61
|
+
},
|
|
62
|
+
}))
|
|
63
|
+
|
|
64
|
+
export default function NavigationTabs({
|
|
65
|
+
tabs,
|
|
66
|
+
size = 'medium',
|
|
67
|
+
center = false,
|
|
68
|
+
}: TabsContainerProps) {
|
|
69
|
+
return (
|
|
70
|
+
<StyledTabsWrapper size={size} center={center}>
|
|
71
|
+
{tabs?.map((item, index) => (
|
|
72
|
+
<NavLink key={index} to={item?.path}>
|
|
73
|
+
{({ isActive }) => (
|
|
74
|
+
<StyledTab active={isActive}>{item?.label}</StyledTab>
|
|
75
|
+
)}
|
|
76
|
+
</NavLink>
|
|
77
|
+
))}
|
|
78
|
+
</StyledTabsWrapper>
|
|
79
|
+
)
|
|
80
|
+
}
|
package/src/components/index.ts
CHANGED
|
@@ -27,6 +27,7 @@ import RenderForm from './Form/RenderForm'
|
|
|
27
27
|
import AsyncSearchSelect from './Input/AsyncSearchSelect'
|
|
28
28
|
import FilterButton from './FilterComponents/FilterButton'
|
|
29
29
|
import Helmet from './Layout/Helmet'
|
|
30
|
+
import NavigationTabs from './Tabs/NavigationTabs'
|
|
30
31
|
export { default as Image } from './Image'
|
|
31
32
|
export { default as PageHeader } from './PageHeader'
|
|
32
33
|
export { PageContent } from './PageContent'
|
|
@@ -83,6 +84,7 @@ export {
|
|
|
83
84
|
AsyncSearchSelect,
|
|
84
85
|
FilterButton,
|
|
85
86
|
Helmet,
|
|
87
|
+
NavigationTabs,
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
export * from './UploadButton/types'
|