To use this mixin in your sass file:
Let's assume that your sass file is on the same directory level as this file,
@import "responsive-mixin"
.container{
import React, { useContext } from "react"; | |
import { Navigate } from "react-router-dom"; | |
import GlobalContext from "./Context/GloablContext"; | |
const PrivateRoute = ({ children }) => { | |
const { isAuthenticated, isLoading } = useContext(GlobalContext); | |
if (!isLoading) { | |
if (isAuthenticated) return children; | |
else return <Navigate to="/login" />; | |
} |
if (cloned) { | |
if (files.find((file: any) => file.title === newFileTitle)) { | |
const titleRegex = new RegExp(`${newFileTitle} \\((\\d+)\\)`); | |
const similarFiles = files.filter((file: any) => | |
titleRegex.test(file.title) | |
); | |
if (similarFiles.length > 0) { | |
const lastFile = similarFiles[similarFiles.length - 1]; | |
const lastFileTitle = lastFile.title; | |
const lastFileTitleMatch = lastFileTitle.match(titleRegex); |
import { useEffect, useState } from "react"; | |
type DeviceType = "mobile" | "tablet" | "desktop"; | |
type ScreenOrientationType = "portrait" | "landscape"; | |
type PlatformType = "client" | "server"; | |
const useDevice = () => { | |
const [device, setDevice] = useState<DeviceType>("desktop"); | |
const [screenOrientation, setScreenOrientation] = | |
useState<ScreenOrientationType>("landscape"); |
export const getObjectFromMongoResponse = <T>(response: any): T | null => { | |
if (response === null || response === undefined) { | |
return null; | |
} | |
const object = response.toObject ? response.toObject() : response; | |
// eslint-disable-next-line no-unused-vars | |
const { _id, __v, createdAt, updatedAt, ...rest } = object; | |
const data = { | |
id: (_id ?? object.id).toString(), |