Skip to content

Commit

Permalink
fix minor build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Eeshau committed Nov 11, 2024
1 parent 36d50cc commit f6bff5f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 23 deletions.
47 changes: 31 additions & 16 deletions packages/app/src/components/DragAndDropTextBox.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
import React from "react";
import styled from 'styled-components';
import styled, { css, ThemeProvider } from 'styled-components';
import { useTheme } from "@mui/material/styles";
import { useDragAndDrop } from '../hooks/useDragAndDrop';
import { Typography } from "@mui/material";

const DragAndDropTextBoxWrapper = styled.div`
const DragAndDropTextBoxWrapper = styled.div<{ highlighted: boolean }>`
display: flex;
flex-direction: column;
align-items: center;
border: 2px dashed #ccc;
padding: 20px;
${({ highlighted, theme }) =>
highlighted
? css`
border-color: ${theme.palette.accent.main};
color: ${theme.palette.accent.main}
`
: ''}
`;

type Props = {
onFileDrop: (file: File) => void;
highlighted?: boolean;
};

const DragAndDropTextBox: React.FC<Props> = ({onFileDrop}) => {
const DragAndDropTextBox: React.FC<Props> = ({ onFileDrop, highlighted = false }) => {
const theme = useTheme();
const {
dragging,
handleDragEnter,
Expand All @@ -25,20 +36,24 @@ const DragAndDropTextBox: React.FC<Props> = ({onFileDrop}) => {
} = useDragAndDrop();

return (
<DragAndDropTextBoxWrapper
onDragEnter={handleDragEnter}
onDragLeave={handleDragLeave}
onDragOver={handleDragOver}
onDragEnd={handleDragEnd}
onDrop={(e) => handleDrop(e, onFileDrop)}
>
{dragging ? (
<div>Drop here</div>
) : (
<div>Drop .eml file here</div>
)}
</DragAndDropTextBoxWrapper>
<ThemeProvider theme={theme}>
<DragAndDropTextBoxWrapper
highlighted={highlighted}
onDragEnter={handleDragEnter}
onDragLeave={handleDragLeave}
onDragOver={handleDragOver}
onDragEnd={handleDragEnd}
onDrop={(e) => handleDrop(e, onFileDrop)}
>
{dragging ? (
<div> Drop here</div>
) : (
<div>Drop .eml file here </div>
)}
</DragAndDropTextBoxWrapper>
</ThemeProvider>
);
};

export default DragAndDropTextBox;

16 changes: 9 additions & 7 deletions packages/app/src/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
'use client';
import { useState } from 'react';
import { Box, Typography, useTheme, Link } from "@mui/material";
import { Box, Typography, Link } from "@mui/material";

type ImgNames = 'XLogo' | 'YoutubeLogo' | 'TelegramLogo' | 'GithubLogo';

const Footer = () => {
const [hoveredImgs, setHoveredImgs] = useState({
const [hoveredImgs, setHoveredImgs] = useState<Record<ImgNames, boolean>>({
XLogo: false,
YoutubeLogo: false,
TelegramLogo: false,
GithubLogo: false,
});

const handleMouseEnter = (img) => {
const handleMouseEnter = (img: ImgNames) => {
setHoveredImgs((prev) => ({ ...prev, [img]: true }));
};

const handleMouseLeave = (img) => {
const handleMouseLeave = (img: ImgNames) => {
setHoveredImgs((prev) => ({ ...prev, [img]: false }));
};

Expand Down Expand Up @@ -70,9 +72,9 @@ const Footer = () => {
>
<Box
component="img"
onMouseEnter={() => handleMouseEnter(icon.name)}
onMouseLeave={() => handleMouseLeave(icon.name)}
src={hoveredImgs[icon.name] ? icon.hoveredImgSrc : icon.imgSrc}
onMouseEnter={() => handleMouseEnter(icon.name as ImgNames)}
onMouseLeave={() => handleMouseLeave(icon.name as ImgNames)}
src={hoveredImgs[icon.name as ImgNames] ? icon.hoveredImgSrc : icon.imgSrc}
alt={icon.alt}
height={20}
width={20}
Expand Down

0 comments on commit f6bff5f

Please sign in to comment.