Skip to content

Commit 75ed6b1

Browse files
author
gitananun
committed
Notifications Popup
1 parent f11144a commit 75ed6b1

File tree

6 files changed

+143
-1
lines changed

6 files changed

+143
-1
lines changed

src/assets/css/main.scss

+71
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,7 @@ footer {
672672
align-items: center;
673673
justify-content: center;
674674
transition: $transition;
675+
color: $secondaryTextColor;
675676
&:hover {
676677
background: $primaryColor;
677678
* {
@@ -887,3 +888,73 @@ footer {
887888
}
888889
}
889890
}
891+
.modal-backdrop {
892+
background: rgb($color: $darkTextColor, $alpha: 0.4);
893+
}
894+
.modal {
895+
opacity: 0;
896+
transition: $transition;
897+
&.in {
898+
opacity: 1;
899+
}
900+
.close {
901+
color: $secondaryTextColor;
902+
cursor: pointer;
903+
font-size: 20px;
904+
margin-right: 10px;
905+
}
906+
.modal-title {
907+
font-size: 18px;
908+
font-weight: 700;
909+
}
910+
.modal-header {
911+
border: 0;
912+
}
913+
.modal-body {
914+
margin-bottom: 10px;
915+
}
916+
.modal-content {
917+
padding: 10px 15px;
918+
border: 0 !important;
919+
.indicator {
920+
display: inline-block;
921+
width: 10px;
922+
height: 10px;
923+
background-color: $primaryColor;
924+
border-radius: 50%;
925+
}
926+
}
927+
.modal-footer {
928+
.footer-text {
929+
cursor: pointer;
930+
color: $primaryColor;
931+
font-size: 14px;
932+
}
933+
}
934+
}
935+
.notification {
936+
padding-bottom: 15px;
937+
padding-top: 15px;
938+
border-bottom: 1px solid $secondaryColor;
939+
transition: $transition;
940+
cursor: pointer;
941+
942+
&:first-child {
943+
padding-top: 0px;
944+
}
945+
&:last-child {
946+
border-bottom: 0;
947+
}
948+
&:hover {
949+
padding: 15px;
950+
background-color: rgb($color: $secondaryColor, $alpha: 0.3);
951+
}
952+
.text {
953+
color: $darkTextColor;
954+
}
955+
.timestamp {
956+
margin-top: 5px !important;
957+
color: $secondaryTextColor;
958+
font-size: 12px;
959+
}
960+
}

src/components/layouts/DashboardHeader.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const DashboardHeader = () => {
99
<DashboardHeaderUser />
1010
</div>
1111
<div className='col d-flex align-items-center icons justify-content-end gap-4'>
12-
<i className='fal fa-bell'></i>
12+
<i className='fal fa-bell' data-toggle='modal' data-target='#notifications-modal'></i>
1313
<span className='divider'>|</span>
1414
<i className='fal fa-cog'></i>
1515
<RoundedPrimaryButton title='Logout' />

src/components/shared/Modal.tsx

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
interface Props {
2+
id: string;
3+
title?: string;
4+
children?: any;
5+
footerChildren?: any;
6+
}
7+
8+
const Modal = (props: Props) => {
9+
return (
10+
<div className='modal' id={props.id} tabIndex={-1} role='dialog'>
11+
<div className='modal-dialog' role='document'>
12+
<div className='modal-content'>
13+
<div className='modal-header'>
14+
<p className='modal-title'>Notifications</p>
15+
<i className='close fa fa-times' data-dismiss='modal'></i>
16+
</div>
17+
<div className='modal-body'>{props.children}</div>
18+
<div className='modal-footer justify-content-start mx-2'>{props.footerChildren}</div>
19+
</div>
20+
</div>
21+
</div>
22+
);
23+
};
24+
25+
export default Modal;
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import CircularIcon from 'components/common/CircularIcon';
2+
3+
const NotificationItem = () => {
4+
return (
5+
<div className='notification'>
6+
<div className='row'>
7+
<div className='col-8'>
8+
<div className='row'>
9+
<div className='col-1'>
10+
<span className='indicator'></span>
11+
</div>
12+
<div className='col'>
13+
<p className='text'>Your password has been changed successfully.</p>
14+
<p className='timestamp'>Jul 23, 2021 at 09:15 AM</p>
15+
</div>
16+
</div>
17+
</div>
18+
<div className='col-4 d-flex align-items-center justify-content-end'>
19+
<CircularIcon iconClassName='fal fa-lock' />
20+
</div>
21+
</div>
22+
</div>
23+
);
24+
};
25+
26+
export default NotificationItem;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import Modal from 'components/shared/Modal';
2+
import NotificationItem from './NotificationItem';
3+
4+
const NotificationsModal = () => {
5+
return (
6+
<Modal
7+
id='notifications-modal'
8+
title='Notifications'
9+
footerChildren={<p className='footer-text'>View all notifications</p>}
10+
>
11+
{[1, 2, 3, 4].map(() => (
12+
<NotificationItem />
13+
))}
14+
</Modal>
15+
);
16+
};
17+
18+
export default NotificationsModal;

src/views/Dashboard.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import DashboardAccountTab from 'components/dashboard/DashboardAccountTab';
22
import DashboardHelpTab from 'components/dashboard/DashboardHelpTab';
33
import DashboardNavTabs from 'components/dashboard/DashboardNavTabs';
44
import DashboardPasswordTab from 'components/dashboard/DashboardPasswordTab';
5+
import NotificationsModal from 'components/shared/NotificationsModal';
56
import DashboardLayout from './layouts/DashboardLayout';
67

78
const Dashboard = () => {
@@ -21,6 +22,7 @@ const Dashboard = () => {
2122
</div>
2223
</div>
2324
</div>
25+
<NotificationsModal />
2426
</DashboardLayout>
2527
);
2628
};

0 commit comments

Comments
 (0)