diff --git a/beta/src/components/MDX/ExpandableExample.tsx b/beta/src/components/MDX/ExpandableExample.tsx index 3419b9ca..402f1131 100644 --- a/beta/src/components/MDX/ExpandableExample.tsx +++ b/beta/src/components/MDX/ExpandableExample.tsx @@ -22,17 +22,29 @@ function ExpandableExample({ excerpt, type, }: ExpandableExampleProps) { + const ref = React.useRef(null); const [isExpanded, setIsExpanded] = React.useState(false); const isDeepDive = type === 'DeepDive'; const isExample = type === 'Example'; return ( -
{ + setIsExpanded(e.target!.open); + }} + onClick={(e) => { + // We toggle using a button instead of this whole area. + e.preventDefault(); + }} + ref={ref} className={cn('my-12 rounded-lg shadow-inner relative', { 'dark:bg-opacity-20 dark:bg-purple-60 bg-purple-5': isDeepDive, 'dark:bg-opacity-20 dark:bg-yellow-60 bg-yellow-5': isExample, })}> -
+
{isExpanded ? 'Hide Details' : 'Show Details'} -
+
{children}
-
+ ); } diff --git a/beta/src/styles/index.css b/beta/src/styles/index.css index 1a9bbc92..1482c24a 100644 --- a/beta/src/styles/index.css +++ b/beta/src/styles/index.css @@ -143,6 +143,10 @@ max-width: calc(min(700px, 100%)); } + summary::-webkit-details-marker { + display: none; + } + @keyframes nav-fadein { from { opacity: 0.5;