@@ -27,7 +27,6 @@ import {
2727 AnimatePresence ,
2828 AnimatePresenceProps ,
2929 motion ,
30- useMotionValue ,
3130 useTransform ,
3231} from "framer-motion"
3332import "katex/dist/katex.min.css"
@@ -49,6 +48,7 @@ import { atomOneLight } from "react-syntax-highlighter/dist/cjs/styles/hljs"
4948import rehypeKatex from "rehype-katex"
5049import remarkGfm from "remark-gfm"
5150import RemarkMathPlugin from "remark-math"
51+ import { usePersistentMotionValue } from "./Hooks"
5252
5353const MotionBox = motion ( Box )
5454const swap = ( to : number ) => ( r : number ) => ( {
@@ -63,9 +63,8 @@ type TaskViewProps = {
6363
6464export const TaskView = ( { children } : TaskViewProps ) => {
6565 const size = useWindowSize ( )
66- const x = useMotionValue ( 700 )
66+ const x = usePersistentMotionValue ( "TaskView-sidebar-width" , size [ 0 ] * 0.3 )
6767 const width = useTransform ( x , ( value ) => size [ 0 ] - 224 - value )
68-
6968 return (
7069 < Flex
7170 flex = { 1 }
@@ -115,8 +114,7 @@ type TaskIOProps = {
115114
116115export const TaskIO = ( { children } : TaskIOProps ) => {
117116 const size = useWindowSize ( )
118- const maxHeight = useMotionValue ( size [ 1 ] )
119- const y = useTransform ( maxHeight , ( value ) => value * 0.7 )
117+ const y = usePersistentMotionValue ( "TaskIO-height" , size [ 0 ] * 0.3 )
120118
121119 return (
122120 < >
@@ -130,7 +128,11 @@ export const TaskIO = ({ children }: TaskIOProps) => {
130128 } }
131129 >
132130 < motion . div
133- style = { { height : y , display : "flex" , position : "relative" } }
131+ style = { {
132+ height : y ,
133+ display : "flex" ,
134+ position : "relative" ,
135+ } }
134136 >
135137 { children [ 1 ] }
136138 { children [ 2 ] }
@@ -144,7 +146,7 @@ export const TaskIO = ({ children }: TaskIOProps) => {
144146 bg = "purple.600"
145147 w = "full"
146148 h = { 2 }
147- dragConstraints = { { top : 200 , bottom : size [ 1 ] - 150 } }
149+ dragConstraints = { { top : 100 , bottom : size [ 1 ] - 150 } }
148150 style = { { y } }
149151 cursor = "row-resize"
150152 key = { JSON . stringify ( size ) }
@@ -237,8 +239,10 @@ const MarkdownOrderedList = ({ children }: OrderedListProps) => (
237239const MarkdownBlock = ( { children } : { children : React . ReactNode } ) => (
238240 < Stack bg = "blackAlpha.100" p = { 2 } m = { 2 } children = { children } />
239241)
240- const MarkdownCode = ( { inline, children, className } : CodeProps ) =>
241- inline ? (
242+ const MarkdownCode = ( { inline, children, className } : CodeProps ) => {
243+ const language = className ?. replace ( "language-" , "" ) || ""
244+
245+ return inline ? (
242246 < Code
243247 colorScheme = "gray"
244248 bg = "gray.175"
@@ -249,11 +253,12 @@ const MarkdownCode = ({ inline, children, className }: CodeProps) =>
249253 < SyntaxHighlighter
250254 children = { String ( children ) . replace ( / \n $ / , "" ) }
251255 style = { atomOneLight }
252- language = { className }
256+ language = { language }
253257 wrapLines
254258 customStyle = { { fontSize : "85%" } }
255259 />
256260 )
261+ }
257262const MarkdownListItem = ( { checked, children } : LiProps ) => (
258263 < ListItem pb = { 1 } display = "flex" >
259264 < ListIcon as = { checked === null ? RxDotFilled : Checkbox } mt = { 1 } />
0 commit comments