-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(json-crdt-peritext-ui): 🎸 use the new surface context state value
- Loading branch information
Showing
14 changed files
with
74 additions
and
29 deletions.
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
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
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
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
39 changes: 39 additions & 0 deletions
39
src/json-crdt-peritext-ui/plugins/toolbar/InlineToolbar/index.tsx
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,39 @@ | ||
// biome-ignore lint: React is used for JSX | ||
import * as React from 'react'; | ||
import {Paper} from 'nice-ui/lib/4-card/Paper'; | ||
import {Flex} from 'nice-ui/lib/3-list-item/Flex'; | ||
import {BasicButton} from '../../../components/BasicButton'; | ||
import {keyframes, rule} from 'nano-theme'; | ||
|
||
const introAnimation = keyframes({ | ||
from: { | ||
tr: 'scale(.9)', | ||
}, | ||
to: { | ||
tr: 'scale(1)', | ||
}, | ||
}); | ||
|
||
const blockClass = rule({ | ||
an: introAnimation + ' .1s forwards', | ||
}); | ||
|
||
// biome-ignore lint: empty interface | ||
export type InlineToolbarProps = {}; | ||
|
||
export const InlineToolbar: React.FC<InlineToolbarProps> = () => { | ||
return ( | ||
<Paper hoverElevate level={3} className={blockClass}> | ||
<Flex style={{alignItems: 'center', columnGap: 4, rowGap: 4, padding: 4, color: 'black'}}> | ||
<BasicButton size={32} width={30} radius={5} onClick={() => {}}> | ||
<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path | ||
d="M5.10505 12C4.70805 12 4.4236 11.912 4.25171 11.736C4.0839 11.5559 4 11.2715 4 10.8827V4.11733C4 3.72033 4.08595 3.43588 4.25784 3.26398C4.43383 3.08799 4.71623 3 5.10505 3C6.42741 3 8.25591 3 9.02852 3C10.1373 3 11.0539 3.98153 11.0539 5.1846C11.0539 6.08501 10.6037 6.81855 9.70327 7.23602C10.8657 7.44851 11.5176 8.62787 11.5176 9.48128C11.5176 10.5125 10.9902 12 9.27734 12C8.77742 12 6.42626 12 5.10505 12ZM8.37891 8.00341H5.8V10.631H8.37891C8.9 10.631 9.6296 10.1211 9.6296 9.29877C9.6296 8.47643 8.9 8.00341 8.37891 8.00341ZM5.8 4.36903V6.69577H8.17969C8.53906 6.69577 9.27734 6.35939 9.27734 5.50002C9.27734 4.64064 8.48047 4.36903 8.17969 4.36903H5.8Z" | ||
fill="currentColor" | ||
/> | ||
</svg> | ||
</BasicButton> | ||
</Flex> | ||
</Paper> | ||
); | ||
}; |
11 changes: 6 additions & 5 deletions
11
src/json-crdt-peritext-ui/plugins/toolbar/RenderPeritext.tsx
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
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 |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import * as React from 'react'; | ||
import type {PeritextSurfaceContextValue} from '../../react'; | ||
import type {ToolbarState} from './state'; | ||
import type {PeritextSurfaceState} from '../../react'; | ||
|
||
export interface DefaultPluginContextValue { | ||
ctx?: PeritextSurfaceContextValue; | ||
export interface ToolbarPluginContextValue { | ||
surface: PeritextSurfaceState; | ||
toolbar: ToolbarState; | ||
} | ||
|
||
export const context = React.createContext<DefaultPluginContextValue>(null!); | ||
export const context = React.createContext<ToolbarPluginContextValue | null>(null); | ||
|
||
export const useDefaultPlugin = () => React.useContext(context); |
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,3 @@ | ||
export class ToolbarState { | ||
|
||
} |