Przeglądaj źródła

Moving useCountdown to shared hooks

Kirk Trombley 5 lat temu
rodzic
commit
979da81692

+ 2 - 2
client/src/components/util/DelayedButton.jsx

@@ -1,6 +1,6 @@
 import React, { useState } from "react";
 import Button from "./Button";
-import useCountdown from "./Timer/useCountdown";
+import useCountdown from "../../hooks/useCountdown";
 
 const CountdownButton = ({ 
   onCancelled, 
@@ -9,7 +9,7 @@ const CountdownButton = ({
   seconds,
 }) => {
   const [remaining, pause] = useCountdown(seconds, onEnd);
-  
+
   return (
     <Button onClick={() => { pause(); onCancelled(); }}>
       {remaining !== 0 ? formatter(remaining) : "Starting!"}

+ 1 - 1
client/src/components/util/Timer/Timer.jsx → client/src/components/util/Timer.jsx

@@ -1,7 +1,7 @@
 import React from "react";
 import styled from "styled-components";
 import ms from "pretty-ms";
-import useCountdown from "./useCountdown";
+import useCountdown from "../../hooks/useCountdown";
 
 const TimerSpan = styled.span`
   padding: 1px;

+ 0 - 1
client/src/components/util/Timer/index.js

@@ -1 +0,0 @@
-export { default } from './Timer';

+ 0 - 0
client/src/components/util/Timer/useCountdown.jsx → client/src/hooks/useCountdown.jsx