Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions src/components/App/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { Route, Switch, useHistory, withRouter } from "react-router-dom";
import SharePage from "../SharePage/SharePage";
import style from "./App.module.css";
import ToggleDarkMode from "../ToggleDarkMode/ToggleDarkMode";
import { ToastContainer, toast } from 'react-toastify';
import { toast } from 'react-toastify';
import AppToastContainer from "../AppToastContainer/AppToastContainer";

// Dark mode custom
import useDarkMode from 'use-dark-mode';
Expand Down Expand Up @@ -57,21 +58,7 @@ const App = () => {
<Switch>
<Route exact path="/">
<Typing handleInputChange={handleInputChange} onSubmit={onSubmit} />
<ToastContainer
toastStyle={{

paddingLeft:'5rem'
}}
position="bottom-center"
autoClose={1000}
hideProgressBar={true}
newestOnTop={false}
closeOnClick
rtl={false}
pauseOnFocusLoss
draggable
pauseOnHover
/>
<AppToastContainer paddingLeft="5rem" />
</Route>
<Route exact path="/:id">
<SharePage />
Expand Down
33 changes: 33 additions & 0 deletions src/components/AppToastContainer/AppToastContainer.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from "react";
import { ToastContainer } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";

const AppToastContainer = ({
color,
paddingLeft,
newestOnTop = false,
...props
}) => {
const toastStyle = {
...(color ? { color } : {}),
...(paddingLeft ? { paddingLeft } : {}),
};

return (
<ToastContainer
toastStyle={toastStyle}
position="bottom-center"
autoClose={1000}
hideProgressBar
newestOnTop={newestOnTop}
closeOnClick
rtl={false}
pauseOnFocusLoss
draggable
pauseOnHover
{...props}
/>
);
};

export default AppToastContainer;
19 changes: 3 additions & 16 deletions src/components/Modal/Modal.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react";
import "./Modal.css";
import { ToastContainer, toast } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
import { toast } from "react-toastify";
import { CopyToClipboard } from "react-copy-to-clipboard";
import Button from '../Button/Button';
import AppToastContainer from "../AppToastContainer/AppToastContainer";
const MODAL_STYLES = {
position: "fixed",
// display: 'flex',
Expand Down Expand Up @@ -40,20 +40,7 @@ export default function Modal({ id, open, children, onClose }) {
const notify = () => toast("Link Copied📋");
return (
<>
<ToastContainer
toastStyle={{
color: 'black',
paddingLeft:'6rem'
}}
position="bottom-center"
autoClose={1000}
hideProgressBar={true}
newestOnTop={true}
closeOnClick
pauseOnFocusLoss
draggable
pauseOnHover
/>
<AppToastContainer color="black" paddingLeft="6rem" newestOnTop />
<div style={OVERLAY_STYLES} />
<div style={MODAL_STYLES}>
<div className="modalTitle">
Expand Down
20 changes: 3 additions & 17 deletions src/components/SharePage/SharePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import Modal from '../Modal/Modal'
import axios from "axios";
import copy from "copy-to-clipboard";
import style from "./SharePage.module.css";
import { ToastContainer, toast } from 'react-toastify';
import { toast } from 'react-toastify';
import xss from 'xss';
import 'react-toastify/dist/ReactToastify.css';
import 'highlight.js/styles/atom-one-light.css';
import AppToastContainer from "../AppToastContainer/AppToastContainer";

const SharePage = () => {
const {id} = useParams();
Expand Down Expand Up @@ -63,21 +63,7 @@ const SharePage = () => {
<Button name="Copy" onClick={notify} />


<ToastContainer
toastStyle={{
color: 'black',
paddingLeft:'3rem'
}}
position="bottom-center"
autoClose={1000}
hideProgressBar={true}
newestOnTop={false}
closeOnClick
rtl={false}
pauseOnFocusLoss
draggable
pauseOnHover
/>
<AppToastContainer color="black" paddingLeft="3rem" />
</div>
<Modal id={id} open={isOpen} onClose={() => setIsOpen(false)}/>
</div>
Expand Down