mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-06-29 08:27:21 -04:00
Embedd asciinema into docs.
Signed-off-by: Fabian Kammel <fk@edgeless.systems>
This commit is contained in:
parent
b356af5a39
commit
e0a4b26e5c
4 changed files with 1064 additions and 0 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