import { HStack, VStack, SpanBox } from '../../elements/LayoutPrimitives' import { Button } from '../../elements/Button' import { StyledText } from '../../elements/StyledText' import { styled, theme } from '../../tokens/stitches.config' import { useEffect, useState } from 'react' import { AlignCenterHorizontalSimple, ArrowsInLineHorizontal, ArrowsOutLineHorizontal, Minus, Pen, Plus, Trash, X } from 'phosphor-react' import { AIcon } from '../../elements/images/AIcon' import { TickedRangeSlider } from '../../elements/TickedRangeSlider' import { showSuccessToast } from '../../../lib/toastHelpers' type ReaderSettingsProps = { marginWidth: number lineHeight: number articleActionHandler: (action: string, arg?: number) => void } const VerticalDivider = styled(SpanBox, { width: '1px', height: '100%', background: `${theme.colors.grayLine.toString()}`, }) export function ReaderSettingsControl(props: ReaderSettingsProps): JSX.Element { const [lineHeight, setLineHeight] = useState(props.lineHeight) const [marginWidth, setMarginWidth] = useState(props.marginWidth) useEffect(() => { setLineHeight(props.lineHeight) setMarginWidth(props.marginWidth) }, [props.lineHeight, props.marginWidth, setLineHeight, setMarginWidth]) return ( Margin: { setMarginWidth(value) props.articleActionHandler('setMarginWidth', value) }} /> Line Spacing: { setLineHeight(value) props.articleActionHandler('setLineHeight', value) }} /> ) }