goobs-frontend 0.8.10 → 0.8.12
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 +12 -13
- package/src/components/Accordion/index.tsx +57 -24
- package/src/components/Button/index.tsx +3 -4
- package/src/components/Card/index.tsx +9 -19
- package/src/components/ComplexTextEditor/SimpleEditor/index.tsx +2 -0
- package/src/components/ComplexTextEditor/ToolbarButton/index.tsx +1 -1
- package/src/components/ComplexTextEditor/Toolbars/Markdown/index.tsx +33 -155
- package/src/components/ComplexTextEditor/Toolbars/Rich/index.tsx +31 -23
- package/src/components/ComplexTextEditor/index.tsx +40 -49
- package/src/components/ComplexTextEditor/utils/useMarkdownEditor.tsx +1 -1
- package/src/components/ComplexTextEditor/utils/useRichtextEditor.tsx +1 -1
- package/src/components/Content/Structure/accordion/useAccordion.tsx +79 -0
- package/src/components/Content/Structure/phoneNumber/usePhoneNumber.tsx +1 -1
- package/src/components/Content/Structure/searchableDropdown/useSearchableDropdown.tsx +65 -0
- package/src/components/Content/Structure/stepper/useStepper.tsx +5 -14
- package/src/components/Content/index.tsx +12 -0
- package/src/components/DateField/index.tsx +1 -39
- package/src/components/Dropdown/index.tsx +27 -28
- package/src/components/Grid/index.tsx +127 -50
- package/src/components/Nav/VerticalVariant/index.tsx +87 -79
- package/src/components/Nav/index.tsx +28 -13
- package/src/components/PhoneNumberField/index.tsx +41 -25
- package/src/components/SearchableDropdown/index.tsx +378 -0
- package/src/components/Stepper/index.tsx +88 -53
- package/src/components/TextField/index.tsx +117 -25
- package/src/index.ts +6 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "goobs-frontend",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A comprehensive React-based UI library built on Material-UI, offering a wide range of customizable components including grids, typography, buttons, cards, forms, navigation, pricing tables, steppers, tooltips, accordions, and more. Designed for building responsive and consistent user interfaces with advanced features like form validation, theming, and code syntax highlighting.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,17 +19,16 @@
|
|
|
19
19
|
"lint": "next lint"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@emotion/cache": "^11.
|
|
23
|
-
"@emotion/react": "^11.
|
|
24
|
-
"@emotion/styled": "^11.
|
|
25
|
-
"@mui/icons-material": "^6.
|
|
26
|
-
"@mui/material": "^6.
|
|
22
|
+
"@emotion/cache": "^11.14.0",
|
|
23
|
+
"@emotion/react": "^11.14.0",
|
|
24
|
+
"@emotion/styled": "^11.14.0",
|
|
25
|
+
"@mui/icons-material": "^6.2.0",
|
|
26
|
+
"@mui/material": "^6.2.0",
|
|
27
27
|
"@types/lodash": "^4.17.13",
|
|
28
|
-
"@types/react-datepicker": "^7.0.0",
|
|
29
28
|
"highlight.js": "^11.10.0",
|
|
30
29
|
"jotai": "^2.10.3",
|
|
31
30
|
"lodash": "^4.17.21",
|
|
32
|
-
"next": "15.0
|
|
31
|
+
"next": "15.1.0",
|
|
33
32
|
"otplib": "^12.0.1",
|
|
34
33
|
"react-datepicker": "^7.5.0",
|
|
35
34
|
"react-qr-code": "^2.0.15",
|
|
@@ -39,14 +38,14 @@
|
|
|
39
38
|
"slate-react": "^0.112.0"
|
|
40
39
|
},
|
|
41
40
|
"devDependencies": {
|
|
42
|
-
"@next/eslint-plugin-next": "^15.0
|
|
43
|
-
"@types/node": "^22.10.
|
|
41
|
+
"@next/eslint-plugin-next": "^15.1.0",
|
|
42
|
+
"@types/node": "^22.10.2",
|
|
44
43
|
"@types/react": "19.0.1",
|
|
45
44
|
"@types/react-dom": "^19.0.1",
|
|
46
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
47
|
-
"@typescript-eslint/parser": "^8.
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "^8.18.0",
|
|
46
|
+
"@typescript-eslint/parser": "^8.18.0",
|
|
48
47
|
"eslint": "^9.16.0",
|
|
49
|
-
"eslint-config-next": "^15.0
|
|
48
|
+
"eslint-config-next": "^15.1.0",
|
|
50
49
|
"eslint-config-prettier": "^9.1.0",
|
|
51
50
|
"eslint-plugin-prettier": "^5.2.1",
|
|
52
51
|
"prettier": "^3.4.2",
|
|
@@ -6,39 +6,72 @@ import MuiAccordion, { AccordionProps } from '@mui/material/Accordion'
|
|
|
6
6
|
import MuiAccordionSummary, {
|
|
7
7
|
AccordionSummaryProps,
|
|
8
8
|
} from '@mui/material/AccordionSummary'
|
|
9
|
-
import MuiAccordionDetails
|
|
9
|
+
import MuiAccordionDetails, {
|
|
10
|
+
AccordionDetailsProps,
|
|
11
|
+
} from '@mui/material/AccordionDetails'
|
|
10
12
|
import { ExpandMore } from '@mui/icons-material'
|
|
11
13
|
import { black } from '../../styles/palette'
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
type CustomAccordionProps = AccordionProps & {
|
|
16
|
+
children: React.ReactNode
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type CustomAccordionSummaryProps = AccordionSummaryProps & {
|
|
20
|
+
children: React.ReactNode
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type CustomAccordionDetailsProps = AccordionDetailsProps & {
|
|
24
|
+
children: React.ReactNode
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const StyledAccordion = styled(MuiAccordion)({
|
|
28
|
+
'&.MuiAccordion-root': {
|
|
29
|
+
'&:before': {
|
|
30
|
+
display: 'none',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const StyledAccordionSummary = styled(MuiAccordionSummary)({
|
|
31
36
|
fontSize: '20px',
|
|
32
37
|
fontFamily: 'merriweather',
|
|
33
38
|
fontWeight: 500,
|
|
34
39
|
})
|
|
35
40
|
|
|
36
|
-
|
|
37
|
-
* Custom styled AccordionDetails component.
|
|
38
|
-
* Wraps MUI's AccordionDetails with custom padding based on the theme's spacing.
|
|
39
|
-
*/
|
|
40
|
-
const AccordionDetails = styled(MuiAccordionDetails)(({ theme }) => ({
|
|
41
|
+
const StyledAccordionDetails = styled(MuiAccordionDetails)(({ theme }) => ({
|
|
41
42
|
padding: theme.spacing(2),
|
|
42
43
|
}))
|
|
43
44
|
|
|
45
|
+
function Accordion({ children, ...props }: CustomAccordionProps) {
|
|
46
|
+
return (
|
|
47
|
+
<StyledAccordion disableGutters {...props}>
|
|
48
|
+
{children}
|
|
49
|
+
</StyledAccordion>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function AccordionSummary({ children, ...props }: CustomAccordionSummaryProps) {
|
|
54
|
+
return (
|
|
55
|
+
<StyledAccordionSummary
|
|
56
|
+
expandIcon={<ExpandMore sx={{ color: black.main }} />}
|
|
57
|
+
{...props}
|
|
58
|
+
>
|
|
59
|
+
{children}
|
|
60
|
+
</StyledAccordionSummary>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function AccordionDetails({ children, ...props }: CustomAccordionDetailsProps) {
|
|
65
|
+
return <StyledAccordionDetails {...props}>{children}</StyledAccordionDetails>
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
Accordion.displayName = 'Accordion'
|
|
69
|
+
AccordionSummary.displayName = 'AccordionSummary'
|
|
70
|
+
AccordionDetails.displayName = 'AccordionDetails'
|
|
71
|
+
|
|
44
72
|
export { Accordion, AccordionSummary, AccordionDetails }
|
|
73
|
+
export type {
|
|
74
|
+
CustomAccordionProps,
|
|
75
|
+
CustomAccordionSummaryProps,
|
|
76
|
+
CustomAccordionDetailsProps,
|
|
77
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import React from 'react'
|
|
2
|
+
import React, { JSX } from 'react'
|
|
3
3
|
import { Button, Box, ButtonProps } from '@mui/material'
|
|
4
4
|
import Typography from '../Typography'
|
|
5
5
|
import { SvgIconProps } from '@mui/material/SvgIcon'
|
|
@@ -84,7 +84,7 @@ const ContentWrapper = styled(Box)<{
|
|
|
84
84
|
gap: '8px',
|
|
85
85
|
}))
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
function CustomButton({
|
|
88
88
|
text,
|
|
89
89
|
variant = 'contained',
|
|
90
90
|
fontvariant = 'merriparagraph',
|
|
@@ -101,7 +101,7 @@ const CustomButton: React.FC<CustomButtonProps> = ({
|
|
|
101
101
|
fontlocation = 'center',
|
|
102
102
|
sx,
|
|
103
103
|
...restProps
|
|
104
|
-
})
|
|
104
|
+
}: CustomButtonProps): JSX.Element {
|
|
105
105
|
const handleButtonClick = (
|
|
106
106
|
event: React.MouseEvent<HTMLButtonElement>
|
|
107
107
|
): void => {
|
|
@@ -159,5 +159,4 @@ const CustomButton: React.FC<CustomButtonProps> = ({
|
|
|
159
159
|
)
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
CustomButton.displayName = 'CustomButton'
|
|
163
162
|
export default CustomButton
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import React, { JSX } from 'react'
|
|
2
4
|
import { BoxProps } from '@mui/material'
|
|
3
5
|
import { CustomStepperProps } from '../Stepper'
|
|
4
6
|
import InventoryCard from './variants/inventory'
|
|
@@ -10,11 +12,7 @@ import DefaultCard from './variants/defaultconfig'
|
|
|
10
12
|
import { columnconfig } from '../Grid'
|
|
11
13
|
import { CustomButtonProps } from '../Button'
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
* Props for the Card component.
|
|
15
|
-
* Extends BoxProps from Material-UI and includes additional custom properties.
|
|
16
|
-
*/
|
|
17
|
-
export interface CardProps extends BoxProps {
|
|
15
|
+
type CardProps = Omit<BoxProps, 'children'> & {
|
|
18
16
|
/** Title of the card */
|
|
19
17
|
title?: string
|
|
20
18
|
/** Whether to show an underline for the title */
|
|
@@ -124,11 +122,7 @@ export interface CardProps extends BoxProps {
|
|
|
124
122
|
columnconfig?: columnconfig
|
|
125
123
|
}
|
|
126
124
|
|
|
127
|
-
|
|
128
|
-
* Card component that renders different card variants based on the provided props.
|
|
129
|
-
* It supports various card types including default, inventory, pricing summary, product, and more.
|
|
130
|
-
*/
|
|
131
|
-
const Card: React.FC<CardProps> = ({
|
|
125
|
+
function Card({
|
|
132
126
|
title,
|
|
133
127
|
titleUnderline = true,
|
|
134
128
|
body,
|
|
@@ -154,8 +148,7 @@ const Card: React.FC<CardProps> = ({
|
|
|
154
148
|
productProps,
|
|
155
149
|
productSummaryProps,
|
|
156
150
|
...rest
|
|
157
|
-
})
|
|
158
|
-
// Render the default card variant
|
|
151
|
+
}: CardProps): JSX.Element | null {
|
|
159
152
|
if (variant === 'default') {
|
|
160
153
|
return (
|
|
161
154
|
<DefaultCard
|
|
@@ -182,7 +175,6 @@ const Card: React.FC<CardProps> = ({
|
|
|
182
175
|
)
|
|
183
176
|
}
|
|
184
177
|
|
|
185
|
-
// Render the inventory card variant
|
|
186
178
|
if (variant === 'inventory') {
|
|
187
179
|
return (
|
|
188
180
|
<InventoryCard
|
|
@@ -196,7 +188,6 @@ const Card: React.FC<CardProps> = ({
|
|
|
196
188
|
)
|
|
197
189
|
}
|
|
198
190
|
|
|
199
|
-
// Render the simple pricing summary card variant
|
|
200
191
|
if (variant === 'pricingsummary') {
|
|
201
192
|
return (
|
|
202
193
|
<SimplePricingSummary
|
|
@@ -208,7 +199,6 @@ const Card: React.FC<CardProps> = ({
|
|
|
208
199
|
)
|
|
209
200
|
}
|
|
210
201
|
|
|
211
|
-
// Render the detailed pricing summary card variant
|
|
212
202
|
if (variant === 'detailedpricingsummary') {
|
|
213
203
|
return (
|
|
214
204
|
<DetailedPricingSummary
|
|
@@ -220,14 +210,12 @@ const Card: React.FC<CardProps> = ({
|
|
|
220
210
|
)
|
|
221
211
|
}
|
|
222
212
|
|
|
223
|
-
// Render the product card variant
|
|
224
213
|
if (variant === 'product') {
|
|
225
214
|
return (
|
|
226
215
|
<ProductCard width={width} height={height} {...productProps} {...rest} />
|
|
227
216
|
)
|
|
228
217
|
}
|
|
229
218
|
|
|
230
|
-
// Render the product summary card variant
|
|
231
219
|
if (variant === 'productsummary') {
|
|
232
220
|
return (
|
|
233
221
|
<ProductSummaryCard
|
|
@@ -244,8 +232,10 @@ const Card: React.FC<CardProps> = ({
|
|
|
244
232
|
)
|
|
245
233
|
}
|
|
246
234
|
|
|
247
|
-
// Return null if no matching variant is found
|
|
248
235
|
return null
|
|
249
236
|
}
|
|
250
237
|
|
|
238
|
+
Card.displayName = 'Card'
|
|
239
|
+
|
|
251
240
|
export default Card
|
|
241
|
+
export type { CardProps }
|
|
@@ -7,7 +7,7 @@ import { handleBoldClick, handleItalicClick } from '../utils/useMarkdownEditor'
|
|
|
7
7
|
import { IconButton, IconButtonProps } from '@mui/material'
|
|
8
8
|
import { InlineFormat, BlockFormat, AlignmentFormat } from '../types'
|
|
9
9
|
|
|
10
|
-
interface ToolbarButtonProps extends IconButtonProps {
|
|
10
|
+
export interface ToolbarButtonProps extends IconButtonProps {
|
|
11
11
|
format?: InlineFormat | BlockFormat | AlignmentFormat
|
|
12
12
|
children: React.ReactNode
|
|
13
13
|
editor?: BaseEditor & ReactEditor & HistoryEditor
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
SelectChangeEvent,
|
|
7
7
|
Stack,
|
|
8
8
|
Typography,
|
|
9
|
+
MenuItem,
|
|
9
10
|
} from '@mui/material'
|
|
10
11
|
import {
|
|
11
12
|
Link,
|
|
@@ -22,19 +23,15 @@ import {
|
|
|
22
23
|
FormatListNumbered,
|
|
23
24
|
FormatListBulleted,
|
|
24
25
|
} from '@mui/icons-material'
|
|
25
|
-
import {
|
|
26
|
-
AlignmentButton,
|
|
27
|
-
AlignmentMenuItem,
|
|
28
|
-
TextType,
|
|
29
|
-
TextTypeMenuItem,
|
|
30
|
-
} from '../Rich/index'
|
|
31
26
|
import { BaseEditor } from 'slate'
|
|
32
27
|
import { ReactEditor } from 'slate-react'
|
|
33
28
|
import { HistoryEditor } from 'slate-history'
|
|
34
|
-
import { AlignmentFormat } from '
|
|
29
|
+
import { AlignmentFormat } from '../../types'
|
|
35
30
|
|
|
36
31
|
type CustomEditor = BaseEditor & ReactEditor & HistoryEditor
|
|
37
32
|
|
|
33
|
+
export type TextType = 'p' | 'h1' | 'h2' | 'h3'
|
|
34
|
+
|
|
38
35
|
interface ToolbarMarkdownProps {
|
|
39
36
|
editor?: CustomEditor
|
|
40
37
|
handleBoldClick?: () => void
|
|
@@ -67,20 +64,8 @@ const ToolbarMarkdown: React.FC<ToolbarMarkdownProps> = ({
|
|
|
67
64
|
}
|
|
68
65
|
|
|
69
66
|
return (
|
|
70
|
-
<Box
|
|
71
|
-
|
|
72
|
-
display: 'flex',
|
|
73
|
-
flexDirection: 'row',
|
|
74
|
-
alignItems: 'center',
|
|
75
|
-
justifyContent: 'center',
|
|
76
|
-
}}
|
|
77
|
-
>
|
|
78
|
-
<Stack
|
|
79
|
-
direction="row"
|
|
80
|
-
alignItems="center"
|
|
81
|
-
justifyContent="center"
|
|
82
|
-
spacing={1}
|
|
83
|
-
>
|
|
67
|
+
<Box>
|
|
68
|
+
<Stack direction="row" spacing={1}>
|
|
84
69
|
{/* undo / redo */}
|
|
85
70
|
<Box>
|
|
86
71
|
<ToolbarButton buttonAction="undo" editor={editor}>
|
|
@@ -93,12 +78,6 @@ const ToolbarMarkdown: React.FC<ToolbarMarkdownProps> = ({
|
|
|
93
78
|
onClick={onSwitchMode}
|
|
94
79
|
markdownMode={markdownMode}
|
|
95
80
|
setMarkdown={setMarkdown}
|
|
96
|
-
sx={{
|
|
97
|
-
fontSize: '14px',
|
|
98
|
-
borderRadius: '4px',
|
|
99
|
-
color: 'black',
|
|
100
|
-
border: '1px solid black',
|
|
101
|
-
}}
|
|
102
81
|
>
|
|
103
82
|
{switchModeLabel}
|
|
104
83
|
</ToolbarButton>
|
|
@@ -108,145 +87,44 @@ const ToolbarMarkdown: React.FC<ToolbarMarkdownProps> = ({
|
|
|
108
87
|
value={textType}
|
|
109
88
|
onChange={handleTextTypeChange}
|
|
110
89
|
variant="outlined"
|
|
111
|
-
sx={{
|
|
112
|
-
p: '8px',
|
|
113
|
-
width: '150px',
|
|
114
|
-
':hover': {
|
|
115
|
-
backgroundColor: 'rgba(0, 0, 0, 0.04)',
|
|
116
|
-
},
|
|
117
|
-
':active': {
|
|
118
|
-
backgroundColor: 'rgba(0, 0, 0, 0.04)',
|
|
119
|
-
},
|
|
120
|
-
'& .MuiSelect-select': { padding: 0 },
|
|
121
|
-
height: '34px',
|
|
122
|
-
'.MuiOutlinedInput-notchedOutline': { border: '1px solid black' },
|
|
123
|
-
'&.Mui-focused .MuiOutlinedInput-notchedOutline': {
|
|
124
|
-
border: '1px solid black',
|
|
125
|
-
},
|
|
126
|
-
}}
|
|
127
|
-
MenuProps={{
|
|
128
|
-
PaperProps: {
|
|
129
|
-
style: {
|
|
130
|
-
boxSizing: 'border-box',
|
|
131
|
-
width: '150px',
|
|
132
|
-
border: '1px solid black',
|
|
133
|
-
minWidth: 0,
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
}}
|
|
137
|
-
renderValue={value => {
|
|
138
|
-
if (value === 'p') {
|
|
139
|
-
return (
|
|
140
|
-
<Box display="flex">
|
|
141
|
-
<Typography fontSize="14px">Paragraph Text</Typography>
|
|
142
|
-
</Box>
|
|
143
|
-
)
|
|
144
|
-
} else if (value === 'h1') {
|
|
145
|
-
return (
|
|
146
|
-
<Box display="flex">
|
|
147
|
-
<Typography fontSize="14px">Heading 1</Typography>
|
|
148
|
-
</Box>
|
|
149
|
-
)
|
|
150
|
-
} else if (value === 'h2') {
|
|
151
|
-
return (
|
|
152
|
-
<Box display="flex">
|
|
153
|
-
<Typography fontSize="14px">Heading 2</Typography>
|
|
154
|
-
</Box>
|
|
155
|
-
)
|
|
156
|
-
} else if (value === 'h3') {
|
|
157
|
-
return (
|
|
158
|
-
<Box display="flex">
|
|
159
|
-
<Typography fontSize="14px">Heading 3</Typography>
|
|
160
|
-
</Box>
|
|
161
|
-
)
|
|
162
|
-
} else return <></>
|
|
163
|
-
}}
|
|
164
90
|
>
|
|
165
|
-
<
|
|
166
|
-
<Typography
|
|
167
|
-
</
|
|
168
|
-
<
|
|
169
|
-
<Typography
|
|
170
|
-
</
|
|
171
|
-
<
|
|
172
|
-
<Typography
|
|
173
|
-
</
|
|
174
|
-
<
|
|
175
|
-
<Typography
|
|
176
|
-
</
|
|
91
|
+
<MenuItem value={'p'}>
|
|
92
|
+
<Typography>Paragraph Text</Typography>
|
|
93
|
+
</MenuItem>
|
|
94
|
+
<MenuItem value={'h1'}>
|
|
95
|
+
<Typography>Heading 1</Typography>
|
|
96
|
+
</MenuItem>
|
|
97
|
+
<MenuItem value={'h2'}>
|
|
98
|
+
<Typography>Heading 2</Typography>
|
|
99
|
+
</MenuItem>
|
|
100
|
+
<MenuItem value={'h3'}>
|
|
101
|
+
<Typography>Heading 3</Typography>
|
|
102
|
+
</MenuItem>
|
|
177
103
|
</Select>
|
|
178
104
|
{/* alignment dropdown */}
|
|
179
105
|
<Select
|
|
180
106
|
value={alignValue}
|
|
181
107
|
onChange={handleAlignChange}
|
|
182
108
|
variant="outlined"
|
|
183
|
-
sx={{
|
|
184
|
-
p: '8px',
|
|
185
|
-
':hover': {
|
|
186
|
-
backgroundColor: 'rgba(0, 0, 0, 0.04)',
|
|
187
|
-
},
|
|
188
|
-
':active': {
|
|
189
|
-
backgroundColor: 'rgba(0, 0, 0, 0.04)',
|
|
190
|
-
},
|
|
191
|
-
'& .MuiSelect-select': { padding: 0 },
|
|
192
|
-
'.MuiOutlinedInput-notchedOutline': { border: 0 },
|
|
193
|
-
'&.Mui-focused .MuiOutlinedInput-notchedOutline': {
|
|
194
|
-
border: 'none !important',
|
|
195
|
-
},
|
|
196
|
-
}}
|
|
197
|
-
MenuProps={{
|
|
198
|
-
PaperProps: {
|
|
199
|
-
style: {
|
|
200
|
-
minWidth: 0,
|
|
201
|
-
},
|
|
202
|
-
},
|
|
203
|
-
}}
|
|
204
|
-
renderValue={value => {
|
|
205
|
-
if (value === 'left') {
|
|
206
|
-
return (
|
|
207
|
-
<Box display="flex">
|
|
208
|
-
<FormatAlignLeft fontSize="small" />
|
|
209
|
-
</Box>
|
|
210
|
-
)
|
|
211
|
-
} else if (value === 'center') {
|
|
212
|
-
return (
|
|
213
|
-
<Box display="flex">
|
|
214
|
-
<FormatAlignCenter fontSize="small" />
|
|
215
|
-
</Box>
|
|
216
|
-
)
|
|
217
|
-
} else if (value === 'right') {
|
|
218
|
-
return (
|
|
219
|
-
<Box display="flex">
|
|
220
|
-
<FormatAlignRight fontSize="small" />
|
|
221
|
-
</Box>
|
|
222
|
-
)
|
|
223
|
-
} else return <></>
|
|
224
|
-
}}
|
|
225
109
|
>
|
|
226
|
-
<
|
|
227
|
-
<
|
|
110
|
+
<MenuItem value={'left'}>
|
|
111
|
+
<ToolbarButton format="left">
|
|
228
112
|
<FormatAlignLeft fontSize="small" />
|
|
229
|
-
<Typography
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
<AlignmentMenuItem value={'center'}>
|
|
235
|
-
<AlignmentButton format="center" activeBackgroundColor="#E7F5FF">
|
|
113
|
+
<Typography>left</Typography>
|
|
114
|
+
</ToolbarButton>
|
|
115
|
+
</MenuItem>
|
|
116
|
+
<MenuItem value={'center'}>
|
|
117
|
+
<ToolbarButton format="center">
|
|
236
118
|
<FormatAlignCenter fontSize="small" />
|
|
237
|
-
<Typography
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
<AlignmentMenuItem value={'right'}>
|
|
243
|
-
<AlignmentButton format="right" activeBackgroundColor="#E7F5FF">
|
|
119
|
+
<Typography>center</Typography>
|
|
120
|
+
</ToolbarButton>
|
|
121
|
+
</MenuItem>
|
|
122
|
+
<MenuItem value={'right'}>
|
|
123
|
+
<ToolbarButton format="right">
|
|
244
124
|
<FormatAlignRight fontSize="small" />
|
|
245
|
-
<Typography
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
</AlignmentButton>
|
|
249
|
-
</AlignmentMenuItem>
|
|
125
|
+
<Typography>right</Typography>
|
|
126
|
+
</ToolbarButton>
|
|
127
|
+
</MenuItem>
|
|
250
128
|
</Select>
|
|
251
129
|
{/* buttons */}
|
|
252
130
|
<Box>
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
import { BaseEditor } from 'slate'
|
|
28
28
|
import { ReactEditor } from 'slate-react'
|
|
29
29
|
import { HistoryEditor } from 'slate-history'
|
|
30
|
-
import { AlignmentFormat } from '
|
|
30
|
+
import { AlignmentFormat } from '../../types'
|
|
31
31
|
|
|
32
32
|
type CustomEditor = BaseEditor & ReactEditor & HistoryEditor
|
|
33
33
|
|
|
@@ -56,19 +56,6 @@ export const TextTypeMenuItem = styled(MenuItem)({
|
|
|
56
56
|
},
|
|
57
57
|
})
|
|
58
58
|
|
|
59
|
-
export const AlignmentButton = styled(ToolbarButton)({
|
|
60
|
-
width: '100%',
|
|
61
|
-
borderRadius: 0,
|
|
62
|
-
justifyContent: 'flex-start',
|
|
63
|
-
'& .MuiTouchRipple-root .MuiTouchRipple-child': {
|
|
64
|
-
borderRadius: 0,
|
|
65
|
-
backgroundColor: '#E7F5FF',
|
|
66
|
-
},
|
|
67
|
-
':hover': {
|
|
68
|
-
backgroundColor: '#E7F5FF',
|
|
69
|
-
},
|
|
70
|
-
})
|
|
71
|
-
|
|
72
59
|
const Toolbar: React.FC<ToolbarProps> = ({
|
|
73
60
|
editor,
|
|
74
61
|
markdownMode,
|
|
@@ -234,40 +221,61 @@ const Toolbar: React.FC<ToolbarProps> = ({
|
|
|
234
221
|
}}
|
|
235
222
|
>
|
|
236
223
|
<AlignmentMenuItem value={'left'}>
|
|
237
|
-
<
|
|
224
|
+
<ToolbarButton
|
|
238
225
|
format="left"
|
|
239
226
|
editor={editor}
|
|
240
|
-
|
|
227
|
+
sx={{
|
|
228
|
+
width: '100%',
|
|
229
|
+
borderRadius: 0,
|
|
230
|
+
justifyContent: 'flex-start',
|
|
231
|
+
':hover': {
|
|
232
|
+
backgroundColor: '#E7F5FF',
|
|
233
|
+
},
|
|
234
|
+
}}
|
|
241
235
|
>
|
|
242
236
|
<FormatAlignLeft fontSize="small" />
|
|
243
237
|
<Typography fontSize={'14px'} mx={1}>
|
|
244
238
|
left
|
|
245
239
|
</Typography>
|
|
246
|
-
</
|
|
240
|
+
</ToolbarButton>
|
|
247
241
|
</AlignmentMenuItem>
|
|
248
242
|
<AlignmentMenuItem value={'center'}>
|
|
249
|
-
<
|
|
243
|
+
<ToolbarButton
|
|
250
244
|
format="center"
|
|
251
245
|
editor={editor}
|
|
252
|
-
|
|
246
|
+
sx={{
|
|
247
|
+
width: '100%',
|
|
248
|
+
borderRadius: 0,
|
|
249
|
+
justifyContent: 'flex-start',
|
|
250
|
+
':hover': {
|
|
251
|
+
backgroundColor: '#E7F5FF',
|
|
252
|
+
},
|
|
253
|
+
}}
|
|
253
254
|
>
|
|
254
255
|
<FormatAlignCenter fontSize="small" />
|
|
255
256
|
<Typography fontSize={'14px'} mx={1}>
|
|
256
257
|
center
|
|
257
258
|
</Typography>
|
|
258
|
-
</
|
|
259
|
+
</ToolbarButton>
|
|
259
260
|
</AlignmentMenuItem>
|
|
260
261
|
<AlignmentMenuItem value={'right'}>
|
|
261
|
-
<
|
|
262
|
+
<ToolbarButton
|
|
262
263
|
format="right"
|
|
263
264
|
editor={editor}
|
|
264
|
-
|
|
265
|
+
sx={{
|
|
266
|
+
width: '100%',
|
|
267
|
+
borderRadius: 0,
|
|
268
|
+
justifyContent: 'flex-start',
|
|
269
|
+
':hover': {
|
|
270
|
+
backgroundColor: '#E7F5FF',
|
|
271
|
+
},
|
|
272
|
+
}}
|
|
265
273
|
>
|
|
266
274
|
<FormatAlignRight fontSize="small" />
|
|
267
275
|
<Typography fontSize={'14px'} mx={1}>
|
|
268
276
|
right
|
|
269
277
|
</Typography>
|
|
270
|
-
</
|
|
278
|
+
</ToolbarButton>
|
|
271
279
|
</AlignmentMenuItem>
|
|
272
280
|
</Select>
|
|
273
281
|
{/* buttons */}
|