-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(notifications): notification board components
- Loading branch information
Showing
10 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import CalendarIcon from 'assets/icons/calendar.svg'; | ||
import InfoIcon from 'assets/icons/info-rounded.svg'; | ||
import LayersIcon from 'assets/icons/layers.svg'; | ||
import WarningIcon from 'assets/icons/warning.svg'; | ||
import { NotificationItemWrapper } from './styles'; | ||
|
||
const NotificationItem = ({ title, description, date, icon }) => { | ||
const renderIcon = (option) => { | ||
switch (option) { | ||
case 'layers': | ||
return <LayersIcon />; | ||
case 'warning': | ||
return <WarningIcon />; | ||
case 'calendar': | ||
return <CalendarIcon />; | ||
default: | ||
return <InfoIcon />; | ||
} | ||
}; | ||
|
||
return ( | ||
<NotificationItemWrapper data-component-type="notification-item"> | ||
<div>{renderIcon(icon)}</div> | ||
<div> | ||
<div className="text"> | ||
<div className="header"> | ||
<div className="title">{title}</div> | ||
<div className="date">{date}</div> | ||
</div> | ||
<div | ||
className="description" | ||
// eslint-disable-next-line react/no-danger | ||
dangerouslySetInnerHTML={{ __html: description }} | ||
/> | ||
</div> | ||
</div> | ||
</NotificationItemWrapper> | ||
); | ||
}; | ||
|
||
NotificationItem.propTypes = { | ||
/** Title of notification. */ | ||
title: PropTypes.string, | ||
/** Description, it supports basic HTML. */ | ||
description: PropTypes.string, | ||
/** YYY-MM-DD */ | ||
date: PropTypes.string, | ||
/** It can be one of the following options: info | warning | calendar | layers */ | ||
icon: PropTypes.string, | ||
}; | ||
|
||
export default NotificationItem; |
12 changes: 12 additions & 0 deletions
12
src/components/notifications/notification-item/notification-item.md
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,12 @@ | ||
Notification item. | ||
|
||
```js | ||
<NotificationItem | ||
icon="layers" | ||
title="Upcoming Event: Notification Title" | ||
description={` | ||
Lorem Ipsum is simply <b>dummy text of the printing</b> and typesetting industry. <a href="/#">Lorem Ipsum</a> has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. | ||
`} | ||
date="2023-08-23" | ||
/> | ||
``` |
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,50 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
export const NotificationItemWrapper = styled.div` | ||
background-color: #ffffff; | ||
display: flex; | ||
flex-direction: row; | ||
gap: 6px; | ||
padding: 20px; | ||
.text { | ||
padding-left: 20px; | ||
padding-right: 20px; | ||
.header { | ||
display: flex; | ||
flex-direction: row; | ||
font-size: 16px; | ||
.title { | ||
font-weight: 500; | ||
width: 75%; | ||
} | ||
.date { | ||
color: #555555; | ||
font-weight: 400; | ||
text-align: right; | ||
width: 25%; | ||
} | ||
} | ||
.description { | ||
font-size: 14px; | ||
line-height: 22.4px; | ||
padding-bottom: 10px; | ||
padding-top: 10px; | ||
text-align: justify; | ||
> b, | ||
strong { | ||
font-weight: 500; | ||
} | ||
> a { | ||
color: #7d953b; | ||
font-weight: 500; | ||
} | ||
} | ||
} | ||
`; |
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,4 @@ | ||
<br /> | ||
Notification components for Notifications Board. | ||
<br /> | ||
<br /> |
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