Skip to content

Commit

Permalink
Fix framework splitter
Browse files Browse the repository at this point in the history
  • Loading branch information
onurkerimov committed May 7, 2024
1 parent a38df97 commit 91c035f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/components/demo-section.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ import 'prismjs/components/prism-jsx';
// }
// })

const getKey = (line) =>
line
.trim()
.replace(/^(export )?const /, '')
.substring(0, 7);

export default () => {
const [state, setState] = useState(defaultOptions)
Expand Down Expand Up @@ -116,10 +121,19 @@ export default () => {
<CodeAnimate
value={codeText}
checkSpecialLine={(line) => ['---'].includes(line)}
renderSpecialLine={() => <hr />}
renderSpecialLine={() => <Splitter framework={state.framework} key={'---'} />}
getKey={getKey}
/>
</div>
</div>
</Section>
)
}

function Splitter(props) {
return <div className='splitter'>
<div className='filename'>
Counter.{props.framework}
</div>
</div>;
}
1 change: 1 addition & 0 deletions src/css/demo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
height: 2.5px;
display: block;
margin-left: -26px;
margin-bottom: 10px;
position: relative;
background-image: radial-gradient(
farthest-corner at 0px 0px,
Expand Down

0 comments on commit 91c035f

Please sign in to comment.