a tool for shared writing and social publishing

add selected state to hr block

+14 -2
+14 -2
components/Blocks/HorizontalRule.tsx
··· 1 - export const HorizontalRule = () => { 2 - return <hr className="my-2 w-full border-border-light" />; 1 + import { useUIState } from "src/useUIState"; 2 + import { BlockProps } from "./Block"; 3 + 4 + export const HorizontalRule = (props: BlockProps) => { 5 + let isSelected = useUIState((s) => 6 + s.selectedBlocks.find((b) => b.value === props.value), 7 + ); 8 + return ( 9 + <hr 10 + className={`my-2 w-full border-border-light 11 + ${isSelected ? "block-border-selected !outline-offset-[3px]" : ""} 12 + `} 13 + /> 14 + ); 3 15 };