diff --git a/publicodes/ui-react/source/mecanisms/Rule.tsx b/publicodes/ui-react/source/mecanisms/Rule.tsx index 3ea6f4dfc..5f3645f51 100644 --- a/publicodes/ui-react/source/mecanisms/Rule.tsx +++ b/publicodes/ui-react/source/mecanisms/Rule.tsx @@ -2,10 +2,17 @@ import { capitalise0 } from 'publicodes' import styled from 'styled-components' import Explanation from '../Explanation' -export default function RuleMecanism({ rawNode, explanation }) { +export default function RuleMecanism({ + rawNode, + explanation, + title, + virtualRule, +}) { return ( - {capitalise0(rawNode.nom)} + + {capitalise0(virtualRule ? rawNode.nom : title)} + ) @@ -14,10 +21,14 @@ export default function RuleMecanism({ rawNode, explanation }) { const Styled = styled.div` display: flex; flex-direction: column; - - code { - align-self: flex-start; - margin: 0; - margin-bottom: 0.2rem; + padding: 1rem; + padding-top: 0rem; + margin: 1rem 0; + border: 1px solid var(--darkColor); + border-radius: 3px; + > .label { + margin: 0 -1rem; + margin-bottom: 1rem; + border-radius: 0rem; } ` diff --git a/publicodes/ui-react/source/mecanisms/common.tsx b/publicodes/ui-react/source/mecanisms/common.tsx index 1d0e48033..d96967084 100644 --- a/publicodes/ui-react/source/mecanisms/common.tsx +++ b/publicodes/ui-react/source/mecanisms/common.tsx @@ -296,7 +296,6 @@ export function Leaf( if (!rule) { throw new Error('Unknown node') } - const [folded, setFolded] = useState(true) const foldButton = useContext(UnfoldIsEnabledContext) ? ( ) : null - if ( node.dottedName === node.contextDottedName + ' . ' + node.name && !node.name.includes(' . ') && rule.virtualRule ) { - return + return } return ( @@ -339,7 +337,7 @@ export function Leaf( }} > - + )}
{capitalise0(rawNode.nom)}