Skip to content

Commit

Permalink
dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
AB10110F committed Aug 20, 2023
1 parent 26ca1ad commit beace3e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/components/CrtSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React, { useState } from 'react';
import styles from '../css/switch.module.css';
import { vt323 } from '../fonts/fonts';
import { useLanguageContext } from '../app/context/language';
import dynamic from "next/dynamic";


interface CrtProps {
changeState: (newValue: boolean) => void;
Expand Down Expand Up @@ -46,4 +48,6 @@ const CrtSwtich: React.FC<CrtProps> = ({ changeState }) => {
);
};

export default CrtSwtich;
export default dynamic (() => Promise.resolve(CrtSwtich), {ssr: false})

/* export default CrtSwtich; */
6 changes: 5 additions & 1 deletion src/components/Dots.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@ const Dots = () => {
}
}

new p5(sketch, sketchRef.current as HTMLElement);

if (typeof window !== 'undefined') {
const p5 = require('p5');
new p5(sketch, sketchRef.current);
}
}, []);

return <div className={styles.background} ref={sketchRef} />;
Expand Down
5 changes: 4 additions & 1 deletion src/components/LanguageSwitch.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import styles from '../css/switch.module.css'
import { vt323 } from '../fonts/fonts';
import { useLanguageContext } from '../app/context/language';
import dynamic from "next/dynamic";

const LanguageSwitch = () => {
const {language, setLanguage} = useLanguageContext();
Expand Down Expand Up @@ -56,4 +57,6 @@ const LanguageSwitch = () => {
)
};

export default LanguageSwitch;
export default dynamic (() => Promise.resolve(LanguageSwitch), {ssr: false})

/* export default LanguageSwitch; */
3 changes: 3 additions & 0 deletions src/components/Terminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useState, useRef, useEffect } from 'react';
import { useLanguageContext } from '../app/context/language';
import styles from '../css/terminal.module.css'
import { vt323 } from '../fonts/fonts'
/* import dynamic from "next/dynamic"; */

const Terminal = () => {

Expand Down Expand Up @@ -331,4 +332,6 @@ const Terminal = () => {
)
};

/* export default dynamic (() => Promise.resolve(Terminal), {ssr: false}) */

export default Terminal

0 comments on commit beace3e

Please sign in to comment.