Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release 0.0.4] Merges staging on main #338

Merged
merged 1 commit into from
May 30, 2024
Merged
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
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import { BrowserRouter } from 'react-router-dom';
import { Routes } from './routes/Routes';
import { SessionProvider } from './contexts';
import { Toaster } from './components/ui/toaster';
import { BackToTop } from '@/components/BackToTop';

const App = () => {
return (
<Fragment>
<Toaster />
<BrowserRouter>
<SessionProvider>
<BackToTop/>
<Routes />
</SessionProvider>
</BrowserRouter>
Expand Down
41 changes: 41 additions & 0 deletions src/components/BackToTop/BackToTop.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { useState } from "react"
import { ArrowUp } from "lucide-react"


const BackToTop =() => {

const [isVisible, setVisibility] = useState(false)

const scrollToTop = () => {
let root = document.getElementById('root')
if (!root) {return}

root.scrollTo({top:0, behavior:"smooth"})

}

document.getElementById("root")?.addEventListener('scroll', (e) => {
if (e.target === null) {return}
let CurrentScrollHeight = (e.target as HTMLElement).scrollTop
let WindowHeight = window.innerHeight

if ( CurrentScrollHeight > WindowHeight / 2) {
setVisibility(true)
} else {
setVisibility(false)
}
})


return (isVisible && (
<button
className=" fixed ease-in-out hidden sm:flex justify-center items-center duration-300
bg-red-600/75 focus:bg-red-700 hover:bg-red-700 z-[100] shadow-slate-600/75
right-6 bottom-6 rounded-full shadow-md
w-12 h-12 "
onClick={scrollToTop}
><ArrowUp color="white" /></button>
));
}

export { BackToTop };
3 changes: 3 additions & 0 deletions src/components/BackToTop/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { BackToTop } from "./BackToTop";

export { BackToTop };
37 changes: 23 additions & 14 deletions src/components/Chip/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,32 @@ import { cva } from 'class-variance-authority';
const Chip = React.forwardRef<HTMLDivElement, IChipProps>((props, ref) => {
const { label, className, variant = 'info', ...rest } = props;

const variants = cva('px-4 py-1.5 font-medium text-sm md:text-md rounded-2xl', {
variants: {
variant: {
warn: 'bg-light-yellow',
success: 'bg-light-green',
danger: 'bg-light-red',
alert: 'bg-light-orange',
info: 'bg-light-blue',
const variants = cva(
'px-4 py-1.5 font-medium text-sm md:text-md rounded-2xl',
{
variants: {
variant: {
warn: 'bg-light-yellow',
success: 'bg-light-green',
danger: 'bg-light-red',
alert: 'bg-light-orange',
info: 'bg-light-blue',
moreInfo: 'bg-gray-200 text-black-600',
},
},
},
defaultVariants: {
variant: 'info',
},
});
defaultVariants: {
variant: 'info',
},
}
);

return (
<span tabIndex={0} ref={ref} {...rest} className={variants({ className, variant })}>
<span
tabIndex={0}
ref={ref}
{...rest}
className={variants({ className, variant })}
>
{label}
</span>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chip/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type ChipVariant = 'info' | 'success' | 'warn' | 'danger';
export type ChipVariant = 'info' | 'success' | 'warn' | 'danger' | 'moreInfo';

export interface IChipProps extends React.ComponentPropsWithoutRef<'div'> {
label: string;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const Header = React.forwardRef<HTMLDivElement, IHeader>((props, ref) => {
{title}
</Link>
</div>
<div className="flex items-center">
<div className="flex items-center h-5">
<div className="cursor-pointer ">{endAdornment}</div>
</div>
</div>
Expand Down
Loading
Loading