Make Org Notifications page responsive.

This commit is contained in:
Kia Lam
2019-05-10 10:23:16 -04:00
parent 349a9c7cc2
commit 82c7052d6f

View File

@@ -5,13 +5,31 @@ import { t } from '@lingui/macro';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { import {
Badge, Badge,
Switch, Switch as PFSwitch,
DataListItem, DataListItem,
DataListItemRow, DataListItemRow,
DataListItemCells, DataListItemCells,
DataListCell, DataListCell as PFDataListCell,
} from '@patternfly/react-core'; } from '@patternfly/react-core';
import styled from 'styled-components';
const DataListCell = styled(PFDataListCell)`
display: flex;
justify-content: ${props => (props.righthalf ? 'flex-start' : 'inherit')};
padding-bottom: ${props => (props.righthalf ? '16px' : '8px')};
@media screen and (min-width: 768px) {
justify-content: ${props => (props.righthalf ? 'flex-end' : 'inherit')};
padding-bottom: 0;
}
`;
const Switch = styled(PFSwitch)`
display: flex;
flex-wrap: no-wrap;
`;
function NotificationListItem (props) { function NotificationListItem (props) {
const { const {
canToggleNotifications, canToggleNotifications,
@@ -21,13 +39,6 @@ function NotificationListItem (props) {
errorTurnedOn, errorTurnedOn,
toggleNotification toggleNotification
} = props; } = props;
const capText = {
textTransform: 'capitalize'
};
const toggleCellStyles = {
display: 'flex',
justifyContent: 'flex-end',
};
return ( return (
<I18n> <I18n>
@@ -43,18 +54,18 @@ function NotificationListItem (props) {
to={{ to={{
pathname: detailUrl pathname: detailUrl
}} }}
style={{ marginRight: '1.5em' }} css="margin-right: 1.5em;"
> >
<b id={`items-list-item-${notification.id}`}>{notification.name}</b> <b id={`items-list-item-${notification.id}`}>{notification.name}</b>
</Link> </Link>
<Badge <Badge
style={capText} css="text-transform: capitalize;"
isRead isRead
> >
{notification.notification_type} {notification.notification_type}
</Badge> </Badge>
</DataListCell>, </DataListCell>,
<DataListCell key="toggles" style={toggleCellStyles}> <DataListCell righthalf="true" key="toggles">
<Switch <Switch
id={`notification-${notification.id}-success-toggle`} id={`notification-${notification.id}-success-toggle`}
label={i18n._(t`Successful`)} label={i18n._(t`Successful`)}