From 2a83b58e40d60dc058f385440a3125c60fb90026 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Sat, 4 Jul 2020 00:05:33 +0300
Subject: refactor: improve scrollTopArrow

---
 src/components/ScrollTopArrow/ScrollTopArrow.tsx | 40 ++++++++++++++----------
 1 file changed, 23 insertions(+), 17 deletions(-)

(limited to 'src/components/ScrollTopArrow/ScrollTopArrow.tsx')

diff --git a/src/components/ScrollTopArrow/ScrollTopArrow.tsx b/src/components/ScrollTopArrow/ScrollTopArrow.tsx
index 6b9d5c9..dfa573f 100644
--- a/src/components/ScrollTopArrow/ScrollTopArrow.tsx
+++ b/src/components/ScrollTopArrow/ScrollTopArrow.tsx
@@ -1,26 +1,33 @@
 import React, { useState } from 'react';
-import { FaArrowCircleUp } from 'react-icons/fa';
-import { makeStyles } from '@material-ui/core';
-import teal from '@material-ui/core/colors/teal';
+import { makeStyles, useTheme } from '@material-ui/core/styles';
+import { useMediaQuery } from '@material-ui/core';
+import ArrowUpwardIcon from '@material-ui/icons/ArrowUpward';
 
-const useStyles = makeStyles(() => ({
-  scrollTop: {
+const useStyles = makeStyles(theme => ({
+  root: {
     position: 'fixed',
-    width: 50,
-    bottom: 50,
-    left: 50,
+    bottom: theme.spacing(10),
+    left: theme.spacing(10),
     zIndex: 1000,
     cursor: 'pointer',
-    opacity: 0.5,
+    opacity: 0.4,
     '&:hover': {
-      opacity: '1'
-    }
+      opacity: 1
+    },
+    background: theme.palette.primary.main,
+    borderRadius: '50%'
+  },
+  icon: {
+    fontSize: 80,
+    color: 'white'
   }
 }));
 
-const ScrollTopArrow:React.FC = () => {
+const ScrollTopArrow: React.FC = () => {
   const [showScroll, setShowScroll] = useState(false);
+  const theme = useTheme();
   const classes = useStyles();
+  const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
 
   const checkScrollTop = () => {
     if (!showScroll && window.pageYOffset > 400) {
@@ -37,11 +44,10 @@ const ScrollTopArrow:React.FC = () => {
   window.addEventListener('scroll', checkScrollTop);
 
   return (
-    <FaArrowCircleUp
-      className={classes.scrollTop}
-      onClick={scrollTop}
-      style={{ height: 50, display: showScroll ? 'block' : 'none', color: teal[700] }}
-    />
+    <div className={classes.root}>
+      {showScroll && !isMobile &&
+        <ArrowUpwardIcon className={classes.icon} color="primary" onClick={scrollTop} />}
+    </div>
   );
 };
 
-- 
cgit v1.2.3


From b52743cc950e9633a2da41f72d3462286c629967 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Sat, 4 Jul 2020 00:08:57 +0300
Subject: style: remove eslint errors

---
 src/components/ScrollTopArrow/ScrollTopArrow.tsx | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

(limited to 'src/components/ScrollTopArrow/ScrollTopArrow.tsx')

diff --git a/src/components/ScrollTopArrow/ScrollTopArrow.tsx b/src/components/ScrollTopArrow/ScrollTopArrow.tsx
index dfa573f..08b8591 100644
--- a/src/components/ScrollTopArrow/ScrollTopArrow.tsx
+++ b/src/components/ScrollTopArrow/ScrollTopArrow.tsx
@@ -27,7 +27,7 @@ const ScrollTopArrow: React.FC = () => {
   const [showScroll, setShowScroll] = useState(false);
   const theme = useTheme();
   const classes = useStyles();
-  const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
+  const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
 
   const checkScrollTop = () => {
     if (!showScroll && window.pageYOffset > 400) {
@@ -45,8 +45,11 @@ const ScrollTopArrow: React.FC = () => {
 
   return (
     <div className={classes.root}>
-      {showScroll && !isMobile &&
-        <ArrowUpwardIcon className={classes.icon} color="primary" onClick={scrollTop} />}
+      {
+        showScroll
+        && !isMobile
+        && <ArrowUpwardIcon className={classes.icon} color="primary" onClick={scrollTop} />
+      }
     </div>
   );
 };
-- 
cgit v1.2.3

