mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-04 23:35:11 -04:00
docs: embedd asciinema casts (#1154)
Signed-off-by: Fabian Kammel <fk@edgeless.systems> Co-authored-by: Moritz Eckert <m1gh7ym0@gmail.com> Co-authored-by: Thomas Tendyck <tt@edgeless.systems> Co-authored-by: 3u13r <lc@edgeless.systems>
This commit is contained in:
parent
cb2d2b0b89
commit
566924caf8
33 changed files with 3825 additions and 134 deletions
22
docs/src/components/AsciinemaWidget/index.js
Normal file
22
docs/src/components/AsciinemaWidget/index.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
import BrowserOnly from '@docusaurus/BrowserOnly';
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import 'asciinema-player/dist/bundle/asciinema-player.css';
|
||||
|
||||
const AsciinemaWidget = ({ src, ...asciinemaOptions}) => {
|
||||
return (
|
||||
<BrowserOnly fallback={<div>Loading asciinema cast...</div>}>
|
||||
{() => {
|
||||
const AsciinemaPlayer = require('asciinema-player');
|
||||
const ref = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
AsciinemaPlayer.create(src, ref.current, asciinemaOptions);
|
||||
}, [src]);
|
||||
|
||||
return <div ref={ref} />;
|
||||
}}
|
||||
</BrowserOnly>
|
||||
);
|
||||
};
|
||||
|
||||
export default AsciinemaWidget;
|
Loading…
Add table
Add a link
Reference in a new issue