Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[@mantine/rte]: Respect defaultRadius from MantineProvider. #2781

Merged
merged 2 commits into from Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import { Accordion } from '@mantine/core';
import { Accordion, MantineProvider } from '@mantine/core';
import { RichTextEditor } from './RichTextEditor';

export default { title: 'RichTextEditor' };
Expand Down Expand Up @@ -50,6 +50,27 @@ export function Usage() {
);
}

export function WithThemeProvider() {
const [value, onChange] = useState(html);
return (
<div style={{ padding: 40, maxWidth: 800, margin: 'auto' }}>
<MantineProvider
theme={{
defaultRadius: 'lg',
primaryColor: 'indigo',
}}
>
<RichTextEditor
value={value}
onChange={onChange}
onImageUpload={handleImageUpload}
stickyOffset={0}
/>
</MantineProvider>
</div>
);
}

export function Placeholder() {
const [value, onChange] = useState('');
return (
Expand Down
Expand Up @@ -71,7 +71,7 @@ export default createStyles(
lineHeight: '32px',
backgroundColor: theme.fn.variant({ variant: 'filled' }).background,
color: theme.white,
borderRadius: theme.radius.sm,
borderRadius: theme.fn.radius(theme.defaultRadius),
fontWeight: 500,
padding: `0 ${theme.spacing.md}px`,
marginRight: theme.spacing.sm,
Expand Down Expand Up @@ -131,7 +131,7 @@ export default createStyles(
textAlign: 'left',
paddingLeft: theme.spacing.sm,
paddingRight: theme.spacing.sm,
borderRadius: theme.radius.sm,
borderRadius: theme.fn.radius(theme.defaultRadius),
marginRight: theme.spacing.md,
border: `1px solid ${
theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[4]
Expand Down Expand Up @@ -203,7 +203,7 @@ export default createStyles(
theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors[theme.primaryColor][0],
padding: '3px 5px',
marginRight: 2,
borderRadius: theme.radius.sm,
borderRadius: theme.fn.radius(theme.defaultRadius),
userSelect: 'all',
pointerEvents: 'none',
},
Expand Down
8 changes: 4 additions & 4 deletions src/mantine-rte/src/components/Toolbar/Toolbar.styles.ts
Expand Up @@ -38,13 +38,13 @@ export default createStyles((theme, { sticky, stickyOffset }: ToolbarStyles) =>
},

'&:first-of-type': {
borderTopLeftRadius: theme.radius.sm,
borderBottomLeftRadius: theme.radius.sm,
borderTopLeftRadius: theme.fn.radius(theme.defaultRadius),
borderBottomLeftRadius: theme.fn.radius(theme.defaultRadius),
},

'&:last-of-type': {
borderTopRightRadius: theme.radius.sm,
borderBottomRightRadius: theme.radius.sm,
borderTopRightRadius: theme.fn.radius(theme.defaultRadius),
borderBottomRightRadius: theme.fn.radius(theme.defaultRadius),
},
},
}));