feat: format with prettier

This commit is contained in:
swve 2024-02-09 21:22:15 +01:00
parent 03fb09c3d6
commit a147ad6610
164 changed files with 11257 additions and 8154 deletions

View file

@ -1,13 +1,12 @@
"use client";
'use client'
function NewCollectionButton() {
return (
<button className="rounded-lg bg-black hover:scale-105 transition-all duration-100 ease-linear antialiased ring-offset-purple-800 p-2 px-5 my-auto font text-xs font-bold text-white drop-shadow-lg flex space-x-2 items-center">
<div>New Collection </div>
<div className='text-md bg-neutral-800 px-1 rounded-full'>+</div>
<div className="text-md bg-neutral-800 px-1 rounded-full">+</div>
</button>
)
}
export default NewCollectionButton
export default NewCollectionButton

View file

@ -1,12 +1,12 @@
"use client";
'use client'
function NewCourseButton() {
return (
<button className="rounded-lg bg-black hover:scale-105 transition-all duration-100 ease-linear antialiased ring-offset-purple-800 p-2 px-5 my-auto font text-xs font-bold text-white drop-shadow-lg flex space-x-2 items-center">
<div>New Course </div>
<div className='text-md bg-neutral-800 px-1 rounded-full'>+</div>
<div className="text-md bg-neutral-800 px-1 rounded-full">+</div>
</button>
)
}
export default NewCourseButton
export default NewCourseButton

View file

@ -1,128 +1,141 @@
'use client';
import React from 'react';
import * as Dialog from '@radix-ui/react-dialog';
import { styled, keyframes } from '@stitches/react';
import { blackA, } from '@radix-ui/colors';
import { AlertTriangle, Info } from 'lucide-react';
'use client'
import React from 'react'
import * as Dialog from '@radix-ui/react-dialog'
import { styled, keyframes } from '@stitches/react'
import { blackA } from '@radix-ui/colors'
import { AlertTriangle, Info } from 'lucide-react'
type ModalParams = {
confirmationMessage: string;
confirmationButtonText: string;
dialogTitle: string;
functionToExecute: any;
dialogTrigger?: React.ReactNode;
status?: "warning" | "info";
};
confirmationMessage: string
confirmationButtonText: string
dialogTitle: string
functionToExecute: any
dialogTrigger?: React.ReactNode
status?: 'warning' | 'info'
}
const ConfirmationModal = (params: ModalParams) => {
const [isDialogOpen, setIsDialogOpen] = React.useState(false);
const warningColors = 'bg-red-100 text-red-600'
const infoColors = 'bg-blue-100 text-blue-600'
const warningButtonColors = 'text-white bg-red-500 hover:bg-red-600'
const infoButtonColors = 'text-white bg-blue-500 hover:bg-blue-600'
const [isDialogOpen, setIsDialogOpen] = React.useState(false)
const warningColors = 'bg-red-100 text-red-600'
const infoColors = 'bg-blue-100 text-blue-600'
const warningButtonColors = 'text-white bg-red-500 hover:bg-red-600'
const infoButtonColors = 'text-white bg-blue-500 hover:bg-blue-600'
const onOpenChange = React.useCallback(
(open: any) => {
setIsDialogOpen(open)
},
[setIsDialogOpen]
)
const onOpenChange = React.useCallback(
(open: any) => {
setIsDialogOpen(open);
},
[setIsDialogOpen]
);
return (
<Dialog.Root open={isDialogOpen} onOpenChange={onOpenChange}>
{params.dialogTrigger ? (
<Dialog.Trigger asChild>{params.dialogTrigger}</Dialog.Trigger>
) : null}
return (
<Dialog.Root open={isDialogOpen} onOpenChange={onOpenChange}>
{params.dialogTrigger ? (
<Dialog.Trigger asChild >
{params.dialogTrigger}
</Dialog.Trigger>
) : null}
<Dialog.Portal>
<DialogOverlay />
<DialogContent >
<div className='h-26 flex space-x-4 tracking-tight'>
<div className={`icon p-6 rounded-xl flex items-center align-content-center ${params.status === 'warning' ? warningColors : infoColors}`}>
{params.status === 'warning' ? <AlertTriangle size={35} /> : <Info size={35} />}
</div>
<div className="text pt-1 space-x-0 w-auto flex-grow">
<div className="text-xl font-bold text-black ">
{params.dialogTitle}
</div>
<div className="text-md text-gray-500 w-60 leading-tight">
{params.confirmationMessage}
</div>
<div className="flex flex-row-reverse pt-2">
<div className={`rounded-md text-sm px-3 py-2 font-bold flex justify-center items-center hover:cursor-pointer ${params.status === 'warning' ? warningButtonColors : infoButtonColors}
<Dialog.Portal>
<DialogOverlay />
<DialogContent>
<div className="h-26 flex space-x-4 tracking-tight">
<div
className={`icon p-6 rounded-xl flex items-center align-content-center ${
params.status === 'warning' ? warningColors : infoColors
}`}
>
{params.status === 'warning' ? (
<AlertTriangle size={35} />
) : (
<Info size={35} />
)}
</div>
<div className="text pt-1 space-x-0 w-auto flex-grow">
<div className="text-xl font-bold text-black ">
{params.dialogTitle}
</div>
<div className="text-md text-gray-500 w-60 leading-tight">
{params.confirmationMessage}
</div>
<div className="flex flex-row-reverse pt-2">
<div
className={`rounded-md text-sm px-3 py-2 font-bold flex justify-center items-center hover:cursor-pointer ${
params.status === 'warning'
? warningButtonColors
: infoButtonColors
}
hover:shadow-lg transition duration-300 ease-in-out
`}
onClick={() => { params.functionToExecute(); setIsDialogOpen(false) }}>
{params.confirmationButtonText}
</div>
</div>
</div>
</div>
</DialogContent>
</Dialog.Portal>
</Dialog.Root>
)
};
onClick={() => {
params.functionToExecute()
setIsDialogOpen(false)
}}
>
{params.confirmationButtonText}
</div>
</div>
</div>
</div>
</DialogContent>
</Dialog.Portal>
</Dialog.Root>
)
}
const overlayShow = keyframes({
'0%': { opacity: 0 },
'100%': { opacity: 1 },
});
'0%': { opacity: 0 },
'100%': { opacity: 1 },
})
const overlayClose = keyframes({
'0%': { opacity: 1 },
'100%': { opacity: 0 },
});
'0%': { opacity: 1 },
'100%': { opacity: 0 },
})
const contentShow = keyframes({
'0%': { opacity: 0, transform: 'translate(-50%, -50%) scale(.96)' },
'100%': { opacity: 1, transform: 'translate(-50%, -50%) scale(1)' },
});
'0%': { opacity: 0, transform: 'translate(-50%, -50%) scale(.96)' },
'100%': { opacity: 1, transform: 'translate(-50%, -50%) scale(1)' },
})
const contentClose = keyframes({
'0%': { opacity: 1, transform: 'translate(-50%, -50%) scale(1)' },
'100%': { opacity: 0, transform: 'translate(-50%, -52%) scale(.96)' },
});
'0%': { opacity: 1, transform: 'translate(-50%, -50%) scale(1)' },
'100%': { opacity: 0, transform: 'translate(-50%, -52%) scale(.96)' },
})
const DialogOverlay = styled(Dialog.Overlay, {
backgroundColor: blackA.blackA9,
position: 'fixed',
zIndex: 500,
inset: 0,
animation: `${overlayShow} 150ms cubic-bezier(0.16, 1, 0.3, 1)`,
'&[data-state="closed"]': {
animation: `${overlayClose} 150ms cubic-bezier(0.16, 1, 0.3, 1)`,
},
});
backgroundColor: blackA.blackA9,
position: 'fixed',
zIndex: 500,
inset: 0,
animation: `${overlayShow} 150ms cubic-bezier(0.16, 1, 0.3, 1)`,
'&[data-state="closed"]': {
animation: `${overlayClose} 150ms cubic-bezier(0.16, 1, 0.3, 1)`,
},
})
const DialogContent = styled(Dialog.Content, {
backgroundColor: 'white',
borderRadius: 18,
zIndex: 501,
boxShadow:
'hsl(206 22% 7% / 35%) 0px 10px 38px -10px, hsl(206 22% 7% / 20%) 0px 10px 20px -15px',
position: 'fixed',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
width: 'auto',
minWidth: '500px',
overflow: 'hidden',
height: 'auto',
maxHeight: '85vh',
maxWidth: '600px',
padding: 11,
animation: `${contentShow} 150ms cubic-bezier(0.16, 1, 0.3, 1)`,
'&:focus': { outline: 'none' },
backgroundColor: 'white',
borderRadius: 18,
zIndex: 501,
boxShadow: 'hsl(206 22% 7% / 35%) 0px 10px 38px -10px, hsl(206 22% 7% / 20%) 0px 10px 20px -15px',
position: 'fixed',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
width: 'auto',
minWidth: '500px',
overflow: 'hidden',
height: 'auto',
maxHeight: '85vh',
maxWidth: '600px',
padding: 11,
animation: `${contentShow} 150ms cubic-bezier(0.16, 1, 0.3, 1)`,
'&:focus': { outline: 'none' },
'&[data-state="closed"]': {
animation: `${contentClose} 150ms cubic-bezier(0.16, 1, 0.3, 1)`,
},
transition: 'max-height 0.3s ease-out',
})
'&[data-state="closed"]': {
animation: `${contentClose} 150ms cubic-bezier(0.16, 1, 0.3, 1)`,
},
transition: "max-height 0.3s ease-out",
});
export default ConfirmationModal;
export default ConfirmationModal

View file

@ -1,21 +1,21 @@
import { XCircle } from 'lucide-react'
import React from 'react'
function ErrorUI() {
return (
<div className='flex items-center justify-center h-screen'>
<div className='mx-auto bg-red-100 w-[800px] p-3 rounded-xl m-5 '>
<div className='flex flex-row'>
<div className='p-3 pr-4 items-center' >
<XCircle size={40} className='text-red-600' />
</div>
<div className='p-3 '>
<h1 className='text-2xl font-bold text-red-600'>Error</h1>
<p className='pt-0 text-md text-red-600'>Something went wrong</p>
</div>
</div>
</div>
return (
<div className="flex items-center justify-center h-screen">
<div className="mx-auto bg-red-100 w-[800px] p-3 rounded-xl m-5 ">
<div className="flex flex-row">
<div className="p-3 pr-4 items-center">
<XCircle size={40} className="text-red-600" />
</div>
<div className="p-3 ">
<h1 className="text-2xl font-bold text-red-600">Error</h1>
<p className="pt-0 text-md text-red-600">Something went wrong</p>
</div>
</div>
)
</div>
</div>
)
}
export default ErrorUI
export default ErrorUI

View file

@ -1,104 +1,110 @@
import React from 'react';
import * as Form from '@radix-ui/react-form';
import { styled } from '@stitches/react';
import { blackA } from '@radix-ui/colors';
import { Info } from 'lucide-react';
import React from 'react'
import * as Form from '@radix-ui/react-form'
import { styled } from '@stitches/react'
import { blackA } from '@radix-ui/colors'
import { Info } from 'lucide-react'
const FormLayout = (props: any, onSubmit: any) => (
<FormRoot className='h-fit' onSubmit={props.onSubmit}>
{props.children}
</FormRoot>
);
<FormRoot className="h-fit" onSubmit={props.onSubmit}>
{props.children}
</FormRoot>
)
export const FormLabelAndMessage = (props: { label: string, message?: string }) => (
<div className='flex items-center space-x-3'>
<FormLabel className='grow'>{props.label}</FormLabel>
{props.message && <div className='text-red-700 text-sm items-center rounded-md flex space-x-1'><Info size={10} /><div>{props.message}</div></div> || <></>}
</div>
);
export const FormLabelAndMessage = (props: {
label: string
message?: string
}) => (
<div className="flex items-center space-x-3">
<FormLabel className="grow">{props.label}</FormLabel>
{(props.message && (
<div className="text-red-700 text-sm items-center rounded-md flex space-x-1">
<Info size={10} />
<div>{props.message}</div>
</div>
)) || <></>}
</div>
)
export const FormRoot = styled(Form.Root, {
margin: 7
});
margin: 7,
})
export const FormField = styled(Form.Field, {
display: 'grid',
marginBottom: 10,
});
display: 'grid',
marginBottom: 10,
})
export const FormLabel = styled(Form.Label, {
fontSize: 15,
fontWeight: 500,
lineHeight: '35px',
color: 'black',
});
fontSize: 15,
fontWeight: 500,
lineHeight: '35px',
color: 'black',
})
export const FormMessage = styled(Form.Message, {
fontSize: 13,
color: 'white',
opacity: 0.8,
});
fontSize: 13,
color: 'white',
opacity: 0.8,
})
export const Flex = styled('div', { display: 'flex' });
export const Flex = styled('div', { display: 'flex' })
export const inputStyles = {
all: 'unset',
boxSizing: 'border-box',
width: '100%',
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
borderRadius: 4,
fontSize: 15,
color: '#7c7c7c',
background: "#F9FAFB",
boxShadow: `0 0 0 1px #edeeef`,
'&:hover': { boxShadow: `0 0 0 1px #edeeef` },
'&:focus': { boxShadow: `0 0 0 2px #edeeef` },
'&::selection': { backgroundColor: blackA.blackA9, color: 'white' },
};
all: 'unset',
boxSizing: 'border-box',
width: '100%',
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
borderRadius: 4,
fontSize: 15,
color: '#7c7c7c',
background: '#F9FAFB',
boxShadow: `0 0 0 1px #edeeef`,
'&:hover': { boxShadow: `0 0 0 1px #edeeef` },
'&:focus': { boxShadow: `0 0 0 2px #edeeef` },
'&::selection': { backgroundColor: blackA.blackA9, color: 'white' },
}
export const Input = styled('input', {
...inputStyles,
height: 35,
lineHeight: 1,
padding: '0 10px',
border: 'none',
});
...inputStyles,
height: 35,
lineHeight: 1,
padding: '0 10px',
border: 'none',
})
export const Textarea = styled('textarea', {
...inputStyles,
resize: 'none',
padding: 10,
});
...inputStyles,
resize: 'none',
padding: 10,
})
export const ButtonBlack = styled('button', {
variants: {
state: {
"loading": {
pointerEvents: 'none',
backgroundColor: "#808080",
},
"none": {
},
},
variants: {
state: {
loading: {
pointerEvents: 'none',
backgroundColor: '#808080',
},
none: {},
},
all: 'unset',
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
borderRadius: 8,
padding: '0 15px',
fontSize: 15,
lineHeight: 1,
fontWeight: 500,
height: 35,
},
all: 'unset',
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
borderRadius: 8,
padding: '0 15px',
fontSize: 15,
lineHeight: 1,
fontWeight: 500,
height: 35,
background: "#000000",
color: "#FFFFFF",
'&:hover': { backgroundColor: "#181818", cursor: "pointer" },
'&:focus': { boxShadow: `0 0 0 2px black` },
});
background: '#000000',
color: '#FFFFFF',
'&:hover': { backgroundColor: '#181818', cursor: 'pointer' },
'&:focus': { boxShadow: `0 0 0 2px black` },
})
export default FormLayout;
export default FormLayout

View file

@ -1,158 +1,155 @@
'use client';
import React from 'react';
import * as Dialog from '@radix-ui/react-dialog';
import { styled, keyframes } from '@stitches/react';
import { blackA, mauve } from '@radix-ui/colors';
import { ButtonBlack } from '../Form/Form';
'use client'
import React from 'react'
import * as Dialog from '@radix-ui/react-dialog'
import { styled, keyframes } from '@stitches/react'
import { blackA, mauve } from '@radix-ui/colors'
import { ButtonBlack } from '../Form/Form'
type ModalParams = {
dialogTitle: string;
dialogDescription: string;
dialogContent: React.ReactNode;
dialogClose?: React.ReactNode | null;
dialogTrigger?: React.ReactNode;
addDefCloseButton?: boolean;
onOpenChange: any;
isDialogOpen?: boolean;
minHeight?: "sm" | "md" | "lg" | "xl" | "no-min";
};
dialogTitle: string
dialogDescription: string
dialogContent: React.ReactNode
dialogClose?: React.ReactNode | null
dialogTrigger?: React.ReactNode
addDefCloseButton?: boolean
onOpenChange: any
isDialogOpen?: boolean
minHeight?: 'sm' | 'md' | 'lg' | 'xl' | 'no-min'
}
const Modal = (params: ModalParams) => (
<Dialog.Root open={params.isDialogOpen} onOpenChange={params.onOpenChange}>
{params.dialogTrigger ? (
<Dialog.Trigger asChild>
{params.dialogTrigger}
</Dialog.Trigger>
<Dialog.Root open={params.isDialogOpen} onOpenChange={params.onOpenChange}>
{params.dialogTrigger ? (
<Dialog.Trigger asChild>{params.dialogTrigger}</Dialog.Trigger>
) : null}
<Dialog.Portal>
<DialogOverlay />
<DialogContent
className="overflow-auto scrollbar-w-2 scrollbar-h-2 scrollbar scrollbar-thumb-black/20 scrollbar-thumb-rounded-full scrollbar-track-rounded-full"
minHeight={params.minHeight}
>
<DialogTopBar className="-space-y-1">
<DialogTitle>{params.dialogTitle}</DialogTitle>
<DialogDescription>{params.dialogDescription}</DialogDescription>
</DialogTopBar>
{params.dialogContent}
{params.dialogClose ? (
<Flex css={{ marginTop: 25, justifyContent: 'flex-end' }}>
<Dialog.Close asChild>{params.dialogClose}</Dialog.Close>
</Flex>
) : null}
<Dialog.Portal>
<DialogOverlay />
<DialogContent className='overflow-auto scrollbar-w-2 scrollbar-h-2 scrollbar scrollbar-thumb-black/20 scrollbar-thumb-rounded-full scrollbar-track-rounded-full' minHeight={params.minHeight}>
<DialogTopBar className='-space-y-1'>
<DialogTitle>{params.dialogTitle}</DialogTitle>
<DialogDescription>
{params.dialogDescription}
</DialogDescription>
</DialogTopBar>
{params.dialogContent}
{params.dialogClose ? (
<Flex css={{ marginTop: 25, justifyContent: 'flex-end' }}>
<Dialog.Close asChild>
{params.dialogClose}
</Dialog.Close>
</Flex>
) : null}
{params.addDefCloseButton ? (
<Flex css={{ marginTop: 25, justifyContent: 'flex-end' }}>
<Dialog.Close asChild>
<ButtonBlack type="submit" css={{ marginTop: 10 }}>Close</ButtonBlack>
</Dialog.Close>
</Flex>
) : null}
</DialogContent>
</Dialog.Portal>
</Dialog.Root>
);
{params.addDefCloseButton ? (
<Flex css={{ marginTop: 25, justifyContent: 'flex-end' }}>
<Dialog.Close asChild>
<ButtonBlack type="submit" css={{ marginTop: 10 }}>
Close
</ButtonBlack>
</Dialog.Close>
</Flex>
) : null}
</DialogContent>
</Dialog.Portal>
</Dialog.Root>
)
const overlayShow = keyframes({
'0%': { opacity: 0 },
'100%': { opacity: 1 },
});
'0%': { opacity: 0 },
'100%': { opacity: 1 },
})
const overlayClose = keyframes({
'0%': { opacity: 1 },
'100%': { opacity: 0 },
});
'0%': { opacity: 1 },
'100%': { opacity: 0 },
})
const contentShow = keyframes({
'0%': { opacity: 0, transform: 'translate(-50%, -50%) scale(.96)' },
'100%': { opacity: 1, transform: 'translate(-50%, -50%) scale(1)' },
});
'0%': { opacity: 0, transform: 'translate(-50%, -50%) scale(.96)' },
'100%': { opacity: 1, transform: 'translate(-50%, -50%) scale(1)' },
})
const contentClose = keyframes({
'0%': { opacity: 1, transform: 'translate(-50%, -50%) scale(1)' },
'100%': { opacity: 0, transform: 'translate(-50%, -52%) scale(.96)' },
});
'0%': { opacity: 1, transform: 'translate(-50%, -50%) scale(1)' },
'100%': { opacity: 0, transform: 'translate(-50%, -52%) scale(.96)' },
})
const DialogOverlay = styled(Dialog.Overlay, {
backgroundColor: blackA.blackA9,
position: 'fixed',
zIndex: 500,
inset: 0,
animation: `${overlayShow} 150ms cubic-bezier(0.16, 1, 0.3, 1)`,
'&[data-state="closed"]': {
animation: `${overlayClose} 150ms cubic-bezier(0.16, 1, 0.3, 1)`,
},
});
backgroundColor: blackA.blackA9,
position: 'fixed',
zIndex: 500,
inset: 0,
animation: `${overlayShow} 150ms cubic-bezier(0.16, 1, 0.3, 1)`,
'&[data-state="closed"]': {
animation: `${overlayClose} 150ms cubic-bezier(0.16, 1, 0.3, 1)`,
},
})
const DialogContent = styled(Dialog.Content, {
variants: {
minHeight: {
'no-min': {
minHeight: '0px',
},
'sm': {
minHeight: '300px',
},
'md': {
minHeight: '500px',
},
'lg': {
minHeight: '700px',
},
'xl': {
minHeight: '900px',
},
},
variants: {
minHeight: {
'no-min': {
minHeight: '0px',
},
sm: {
minHeight: '300px',
},
md: {
minHeight: '500px',
},
lg: {
minHeight: '700px',
},
xl: {
minHeight: '900px',
},
},
},
backgroundColor: 'white',
borderRadius: 18,
zIndex: 501,
boxShadow: 'hsl(206 22% 7% / 35%) 0px 10px 38px -10px, hsl(206 22% 7% / 20%) 0px 10px 20px -15px',
position: 'fixed',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
width: '90vw',
maxHeight: '85vh',
minHeight: '300px',
maxWidth: '600px',
padding: 11,
animation: `${contentShow} 150ms cubic-bezier(0.16, 1, 0.3, 1)`,
'&:focus': { outline: 'none' },
backgroundColor: 'white',
borderRadius: 18,
zIndex: 501,
boxShadow:
'hsl(206 22% 7% / 35%) 0px 10px 38px -10px, hsl(206 22% 7% / 20%) 0px 10px 20px -15px',
position: 'fixed',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
width: '90vw',
maxHeight: '85vh',
minHeight: '300px',
maxWidth: '600px',
padding: 11,
animation: `${contentShow} 150ms cubic-bezier(0.16, 1, 0.3, 1)`,
'&:focus': { outline: 'none' },
'&[data-state="closed"]': {
animation: `${contentClose} 150ms cubic-bezier(0.16, 1, 0.3, 1)`,
},
transition: "max-height 0.3s ease-out",
});
'&[data-state="closed"]': {
animation: `${contentClose} 150ms cubic-bezier(0.16, 1, 0.3, 1)`,
},
transition: 'max-height 0.3s ease-out',
})
const DialogTopBar = styled('div', {
background: "#F7F7F7",
padding: "8px 14px ",
borderRadius: 14,
});
background: '#F7F7F7',
padding: '8px 14px ',
borderRadius: 14,
})
const DialogTitle = styled(Dialog.Title, {
margin: 0,
fontWeight: 700,
letterSpacing: "-0.05em",
padding: 0,
color: mauve.mauve12,
fontSize: 21,
});
margin: 0,
fontWeight: 700,
letterSpacing: '-0.05em',
padding: 0,
color: mauve.mauve12,
fontSize: 21,
})
const DialogDescription = styled(Dialog.Description, {
color: mauve.mauve11,
letterSpacing: "-0.03em",
fontSize: 15,
padding: 0,
margin: 0,
});
color: mauve.mauve11,
letterSpacing: '-0.03em',
fontSize: 15,
padding: 0,
margin: 0,
})
const Flex = styled('div', { display: 'flex' });
const Flex = styled('div', { display: 'flex' })
export default Modal;
export default Modal

View file

@ -1,32 +1,27 @@
import Image from 'next/image'
import CoursesLogo from "public/svg/courses.svg";
import CollectionsLogo from "public/svg/collections.svg";
import TrailLogo from "public/svg/trail.svg";
import CoursesLogo from 'public/svg/courses.svg'
import CollectionsLogo from 'public/svg/collections.svg'
import TrailLogo from 'public/svg/trail.svg'
function TypeOfContentTitle(props: { title: string, type: string }) {
function getLogo() {
if (props.type == "col") {
return CollectionsLogo;
}
else if (props.type == "cou") {
return CoursesLogo;
}
else if (props.type == "tra") {
return TrailLogo;
}
function TypeOfContentTitle(props: { title: string; type: string }) {
function getLogo() {
if (props.type == 'col') {
return CollectionsLogo
} else if (props.type == 'cou') {
return CoursesLogo
} else if (props.type == 'tra') {
return TrailLogo
}
}
return (
<div className="home_category_title flex my-5 items-center">
<div className="ml-2 rounded-full ring-1 ring-slate-900/5 shadow-inner p-2 my-auto mr-4">
<Image className="" src={getLogo()} alt="Courses logo" />
</div>
<h1 className="font-bold text-2xl">{props.title}</h1>
</div>
)
return (
<div className="home_category_title flex my-5 items-center">
<div className="ml-2 rounded-full ring-1 ring-slate-900/5 shadow-inner p-2 my-auto mr-4">
<Image className="" src={getLogo()} alt="Courses logo" />
</div>
<h1 className="font-bold text-2xl">{props.title}</h1>
</div>
)
}
export default TypeOfContentTitle
export default TypeOfContentTitle

View file

@ -1,12 +1,13 @@
'use client';
'use client'
import React from 'react'
import { Toaster } from 'react-hot-toast';
import { Toaster } from 'react-hot-toast'
function Toast() {
return (
<><Toaster /></>
)
return (
<>
<Toaster />
</>
)
}
export default Toast
export default Toast

View file

@ -1,66 +1,65 @@
'use client';
import React from 'react';
import * as Tooltip from '@radix-ui/react-tooltip';
import { styled, keyframes } from '@stitches/react';
'use client'
import React from 'react'
import * as Tooltip from '@radix-ui/react-tooltip'
import { styled, keyframes } from '@stitches/react'
type TooltipProps = {
sideOffset?: number;
content: React.ReactNode;
children: React.ReactNode;
side?: 'top' | 'right' | 'bottom' | 'left'; // default is bottom
slateBlack?: boolean;
};
sideOffset?: number
content: React.ReactNode
children: React.ReactNode
side?: 'top' | 'right' | 'bottom' | 'left' // default is bottom
slateBlack?: boolean
}
const ToolTip = (props: TooltipProps) => {
return (
<Tooltip.Provider delayDuration={200}>
<Tooltip.Root>
<Tooltip.Trigger asChild>
{props.children}
</Tooltip.Trigger>
<Tooltip.Trigger asChild>{props.children}</Tooltip.Trigger>
<Tooltip.Portal>
<TooltipContent slateBlack={props.slateBlack} side={props.side ? props.side : 'bottom'} sideOffset={props.sideOffset}>
<TooltipContent
slateBlack={props.slateBlack}
side={props.side ? props.side : 'bottom'}
sideOffset={props.sideOffset}
>
{props.content}
</TooltipContent>
</Tooltip.Portal>
</Tooltip.Root>
</Tooltip.Provider>
);
};
)
}
const slideUpAndFade = keyframes({
'0%': { opacity: 0, transform: 'translateY(2px)' },
'100%': { opacity: 1, transform: 'translateY(0)' },
});
})
const slideRightAndFade = keyframes({
'0%': { opacity: 0, transform: 'translateX(-2px)' },
'100%': { opacity: 1, transform: 'translateX(0)' },
});
})
const slideDownAndFade = keyframes({
'0%': { opacity: 0, transform: 'translateY(-2px)' },
'100%': { opacity: 1, transform: 'translateY(0)' },
});
})
const slideLeftAndFade = keyframes({
'0%': { opacity: 0, transform: 'translateX(2px)' },
'100%': { opacity: 1, transform: 'translateX(0)' },
});
})
const closeAndFade = keyframes({
'0%': { opacity: 1 },
'100%': { opacity: 0 },
});
})
const TooltipContent = styled(Tooltip.Content, {
variants: {
slateBlack: {
true: {
backgroundColor: " #0d0d0d",
backgroundColor: ' #0d0d0d',
color: 'white',
},
},
@ -70,10 +69,11 @@ const TooltipContent = styled(Tooltip.Content, {
padding: '5px 10px',
fontSize: 12,
lineHeight: 1,
color: "black",
color: 'black',
backgroundColor: 'rgba(217, 217, 217, 0.50)',
zIndex: 500,
boxShadow: 'hsl(206 22% 7% / 35%) 0px 10px 38px -10px, hsl(206 22% 7% / 20%) 0px 10px 20px -15px',
boxShadow:
'hsl(206 22% 7% / 35%) 0px 10px 38px -10px, hsl(206 22% 7% / 20%) 0px 10px 20px -15px',
userSelect: 'none',
animationDuration: '400ms',
animationTimingFunction: 'cubic-bezier(0.16, 1, 0.3, 1)',
@ -92,8 +92,6 @@ const TooltipContent = styled(Tooltip.Content, {
'&[data-side="bottom"]': { animationName: closeAndFade },
'&[data-side="left"]': { animationName: closeAndFade },
},
});
})
export default ToolTip;
export default ToolTip

View file

@ -1,11 +1,9 @@
function GeneralWrapperStyled({ children }: { children: React.ReactNode }) {
return (
<div
className='max-w-screen-2xl mx-auto px-16 py-5 tracking-tight z-50'
>{children}</div>
)
return (
<div className="max-w-screen-2xl mx-auto px-16 py-5 tracking-tight z-50">
{children}
</div>
)
}
export default GeneralWrapperStyled
export default GeneralWrapperStyled