-
-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
524 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { ComponentProps, FC, ReactNode } from 'react'; | ||
import classNames from 'classnames'; | ||
import { XIcon } from '@heroicons/react/solid'; | ||
|
||
export type AlertProps = { | ||
color?: 'blue' | 'red' | 'green' | 'yellow' | 'gray'; | ||
Icon?: FC<ComponentProps<'svg'>>; | ||
rounded?: boolean; | ||
withBorderAccent?: boolean; | ||
additionalContent?: ReactNode; | ||
onDismiss?: () => void; | ||
}; | ||
|
||
export const Alert: FC<AlertProps> = ({ | ||
children, | ||
color = 'blue', | ||
Icon, | ||
rounded = true, | ||
withBorderAccent, | ||
additionalContent, | ||
onDismiss, | ||
}) => { | ||
return ( | ||
<div | ||
className={classNames('flex flex-col p-4 gap-2 text-sm', { | ||
'rounded-lg': rounded, | ||
'border-t-4': withBorderAccent, | ||
'text-blue-700 bg-blue-100 border-blue-500 dark:bg-blue-200 dark:text-blue-800': | ||
color === 'blue', | ||
'text-red-700 bg-red-100 border-red-500 dark:bg-red-200 dark:text-red-800': | ||
color === 'red', | ||
'text-green-700 bg-green-100 border-green-500 dark:bg-green-200 dark:text-green-800': | ||
color === 'green', | ||
'text-yellow-700 bg-yellow-100 border-yellow-500 dark:bg-yellow-200 dark:text-yellow-800': | ||
color === 'yellow', | ||
'text-gray-700 bg-gray-100 border-gray-500 dark:bg-gray-700 dark:text-gray-300': | ||
color === 'gray', | ||
})} | ||
role="alert" | ||
> | ||
<div className="flex items-center"> | ||
{Icon && <Icon className="inline flex-shrink-0 mr-3 h-5 w-5" />} | ||
<div>{children}</div> | ||
{onDismiss && ( | ||
<button | ||
type="button" | ||
className={classNames( | ||
'ml-auto -mx-1.5 -my-1.5 rounded-lg focus:ring-2 p-1.5 inline-flex h-8 w-8', | ||
{ | ||
'bg-blue-100 text-blue-500 focus:ring-blue-400 hover:bg-blue-200 dark:bg-blue-200 dark:text-blue-600 dark:hover:bg-blue-300': | ||
color === 'blue', | ||
'bg-red-100 text-red-500 focus:ring-red-400 hover:bg-red-200 dark:bg-red-200 dark:text-red-600 dark:hover:bg-red-300': | ||
color === 'red', | ||
'bg-green-100 text-green-500 focus:ring-green-400 hover:bg-green-200 dark:bg-green-200 dark:text-green-600 dark:hover:bg-green-300': | ||
color === 'green', | ||
'bg-yellow-100 text-yellow-500 focus:ring-yellow-400 hover:bg-yellow-200 dark:bg-yellow-200 dark:text-yellow-600 dark:hover:bg-yellow-300': | ||
color === 'yellow', | ||
'bg-gray-100 text-gray-500 focus:ring-gray-400 hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-white': | ||
color === 'gray', | ||
}, | ||
)} | ||
aria-label="Close" | ||
onClick={onDismiss} | ||
> | ||
<span className="sr-only">Close</span> | ||
<XIcon className="w-5 h-5" /> | ||
</button> | ||
)} | ||
</div> | ||
{additionalContent && <div>{additionalContent}</div>} | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './Alert'; | ||
export * from './Navbar'; | ||
export * from './Sidebar'; | ||
export * from './DarkThemeToggle'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
@tailwind base; | ||
@import "~flowbite"; | ||
|
||
@tailwind components; | ||
@tailwind utilities; | ||
|
||
::-webkit-scrollbar { | ||
@apply w-1 h-1 bg-gray-100 dark:bg-gray-900; | ||
} | ||
|
||
::-webkit-scrollbar-thumb { | ||
@apply bg-gray-300 hover:bg-gray-400 dark:border-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { StrictMode } from 'react'; | ||
import { render } from 'react-dom'; | ||
import { Dashboard } from './Dashboard'; | ||
import { BrowserRouter } from 'react-router-dom'; | ||
|
||
import './index.css'; | ||
import 'flowbite'; | ||
|
||
render( | ||
<StrictMode> | ||
<BrowserRouter> | ||
<Dashboard /> | ||
</StrictMode>, | ||
</BrowserRouter>, | ||
document.getElementById('root'), | ||
); |
Oops, something went wrong.