Skip to content

Commit

Permalink
fix: Typedの廃止 #160 (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
bicstone authored Dec 15, 2020
1 parent 30556a9 commit e4341b0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 29 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@
"react": "17.0.1",
"react-dom": "17.0.1",
"react-helmet": "6.1.0",
"react-i18next": "11.8.4",
"typed.js": "2.0.11"
"react-i18next": "11.8.4"
},
"devDependencies": {
"@babel/cli": "7.12.10",
Expand Down
24 changes: 2 additions & 22 deletions src/components/sections/Hello.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useEffect, useRef } from 'react';
import React from 'react';
import { graphql, useStaticQuery } from 'gatsby';
import { useI18next } from 'gatsby-plugin-react-i18next';
import Typed, { TypedOptions } from 'typed.js';
import { Typography, Grid, Button, makeStyles } from '@material-ui/core';
import { Breakpoint } from '@material-ui/core/styles/createBreakpoints';
import { BicstoneIcon } from '../';
Expand All @@ -20,24 +19,6 @@ export const Hello: React.FC = () => {
const { t, language } = useI18next();
const width = useBreakPoint();
const BUTTON_SMALL_WIDTH: Breakpoint[] = ['xs'];
const wrapEl = useRef<HTMLSpanElement>(null);
useEffect(() => {
if (wrapEl.current) {
const options: TypedOptions = {
typeSpeed: 60,
showCursor: false,
autoInsertCss: false,
strings: [t('hello.title')],
};
// @see https://github.com/mattboldt/typed.js/pull/461
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Typedの型定義が誤っており、HTMLSpanElementは割当可能
const typed = new Typed(wrapEl.current, options);
return () => {
typed.destroy();
};
}
}, [wrapEl.current]);
const { allContentfulHello }: HelloDataQuery = useStaticQuery(
graphql`
query HelloData {
Expand All @@ -64,8 +45,7 @@ export const Hello: React.FC = () => {
</Grid>
<Grid item xs={11} sm={10}>
<Typography component="span" variant="h6">
<span ref={wrapEl} />
&nbsp;
{t('hello.title')}
</Typography>
<Typography variant="body1" paragraph>
{t('hello.description')}
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15932,11 +15932,6 @@ type@^2.0.0:
resolved "https://registry.yarnpkg.com/type/-/type-2.1.0.tgz#9bdc22c648cf8cf86dd23d32336a41cfb6475e3f"
integrity sha512-G9absDWvhAWCV2gmF1zKud3OyC61nZDwWvBL2DApaVFogI07CprggiQAOOjvp2NRjYWFzPyu7vwtDrQFq8jeSA==

[email protected]:
version "2.0.11"
resolved "https://registry.yarnpkg.com/typed.js/-/typed.js-2.0.11.tgz#d298a91f959f11a3803bf48b841a6fadd29640d9"
integrity sha512-1ZORHalEyLob34q738mqmwp0pT6syMigB1SZuTItqdhovWBKFIt7I5uVALXAGQZCg2MCtihCt6uqkoqPJK+9iQ==

typedarray-to-buffer@^3.1.5:
version "3.1.5"
resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080"
Expand Down

0 comments on commit e4341b0

Please sign in to comment.