-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
97163dc
commit 5d90395
Showing
5 changed files
with
100 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { useEffect, useState } from 'react'; | ||
|
||
type IProps = { | ||
text: string; | ||
delay: number; | ||
}; | ||
|
||
export default function Typewriter(props: IProps) { | ||
const { text, delay } = props; | ||
const [currentText, setCurrentText] = useState(''); | ||
const [currentIndex, setCurrentIndex] = useState(0); | ||
|
||
useEffect(() => { | ||
if (currentIndex < text.length) { | ||
const timeout = setTimeout(() => { | ||
setCurrentText(prevText => prevText + text[currentIndex]); | ||
setCurrentIndex(prevIndex => prevIndex + 1); | ||
}, delay); | ||
|
||
return () => clearTimeout(timeout); | ||
} | ||
}, [currentIndex, delay, text]); | ||
|
||
return <span>{currentText}</span>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ColorPaletteProp } from '@mui/joy'; | ||
import Link from '@mui/joy/Link'; | ||
import { LinkProps, Link as RouterLink } from 'react-router-dom'; | ||
|
||
export interface IProps extends LinkProps { | ||
color?: ColorPaletteProp | ||
} | ||
|
||
export default function DRLink(props: IProps) { | ||
const { | ||
...rest | ||
} = props | ||
|
||
return ( | ||
|
||
<Link | ||
{...rest} | ||
component={RouterLink} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,21 @@ | ||
import { Typography, TypographyProps, TypographyTypeMap } from "@mui/joy"; | ||
import { Theme, useMediaQuery } from "@mui/material"; | ||
import Typewriter from "components/Animation/Typewriter"; | ||
|
||
export default function DRLogo() { | ||
interface IProps extends TypographyProps<TypographyTypeMap['defaultComponent'], { | ||
component?: React.ElementType; | ||
}> { | ||
} | ||
|
||
export default function DRLogo(props: IProps) { | ||
const lgScreen = useMediaQuery((theme: Theme) => theme.breakpoints.up("lg")); | ||
return ( | ||
<> | ||
<strong>DR</strong>incs | ||
</> | ||
<Typography | ||
{...props} | ||
> | ||
<strong>DR</strong> | ||
{lgScreen && <Typewriter text={"incs Productions"} delay={100} />} | ||
{!lgScreen && <Typewriter text={"incs"} delay={100} />} | ||
</Typography> | ||
); | ||
} |