-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(EditorView): add padding variables (#477)
- Loading branch information
1 parent
bd0f0f3
commit ef7851f
Showing
6 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import type {Meta, StoryObj} from '@storybook/react'; | ||
|
||
import {CustomCSSVariablesDemo} from './CSSVariablesDemo'; | ||
|
||
const meta: Meta = { | ||
title: 'Experiments / Custom CSS Variables', | ||
component: CustomCSSVariablesDemo, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof CustomCSSVariablesDemo>; | ||
|
||
export const CustomCSSVariables: Story = { | ||
argTypes: { | ||
'--g-md-toolbar-padding': { | ||
control: {type: 'text'}, | ||
description: 'Toolbar padding', | ||
}, | ||
'--g-md-toolbar-sticky-padding': { | ||
control: {type: 'text'}, | ||
description: 'Toolbar padding in sticky mode', | ||
}, | ||
'--g-md-toolbar-sticky-inset': { | ||
control: {type: 'text'}, | ||
description: 'Toolbar inset in sticky mode', | ||
}, | ||
'--g-md-toolbar-sticky-offset': { | ||
control: {type: 'text'}, | ||
description: 'Toolbar padding in sticky mode', | ||
}, | ||
'--g-md-editor-padding': { | ||
control: {type: 'text'}, | ||
description: 'Editor contents padding', | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react'; | ||
|
||
import {PlaygroundMini} from '../playground/PlaygroundMini'; | ||
|
||
export const CustomCSSVariablesDemo = React.memo((styles) => { | ||
return ( | ||
<div style={styles}> | ||
<PlaygroundMini | ||
initialEditor="wysiwyg" | ||
settingsVisible | ||
withDefaultInitialContent | ||
stickyToolbar | ||
/> | ||
</div> | ||
); | ||
}); | ||
|
||
CustomCSSVariablesDemo.displayName = 'CustomCSSVariables'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## How to customize the editor | ||
You can use CSS variables to make editor contents fit your own needs | ||
| **Variable** | **Description** | **CSS Property Type** | **Default** | | ||
| :---: | :---: | :---: | :---: | | ||
| `--g-md-toolbar-padding` | Toolbar padding | padding | 0px | | ||
| `--g-md-toolbar-sticky-padding` | Toolbar padding in sticky mode | padding | -4px | | ||
| `--g-md-toolbar-sticky-inset` | Toolbar inset in sticky mode | inset | -4px | | ||
| `--g-md-toolbar-sticky-offset` | Toolbar offset in sticky mode | top | 0px | | ||
| `--g-md-editor-padding` | Editor contents padding | padding | 0px | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters