added notification styles

This commit is contained in:
Jon 2021-06-14 16:08:14 +01:00
parent 221c719760
commit d4636a9450
4 changed files with 69 additions and 27 deletions

View File

@ -121,6 +121,28 @@ export const Button = forwardRef(
cursor: not-allowed; cursor: not-allowed;
} }
.button.error {
background: var(--secondary-default);
border-color: var(--secondary-default);
}
.button.error:focus {
box-shadow: 0 0 0px 3px ${hexa(theme.secondary.default, 0.35)};
}
.button.error:hover {
border-color: var(--secondary-dark);
}
.button.success {
background: var(--green-default);
border-color: var(--green-default);
}
.button.success:focus {
box-shadow: 0 0 0px 3px ${hexa(theme.green.default, 0.35)};
}
.button.success:hover {
border-color: var(--green-dark);
}
.button.shadow { .button.shadow {
box-shadow: 0 0 4px 0 rgb(0 0 0 / 8%), 0 4px 4px 0 rgb(0 0 0 / 4%); box-shadow: 0 0 4px 0 rgb(0 0 0 / 8%), 0 4px 4px 0 rgb(0 0 0 / 4%);
} }
@ -129,6 +151,10 @@ export const Button = forwardRef(
box-shadow: 0 0 4px 0 rgb(0 0 0 / 8%), 0 4px 4px 0 rgb(0 0 0 / 12%); box-shadow: 0 0 4px 0 rgb(0 0 0 / 8%), 0 4px 4px 0 rgb(0 0 0 / 12%);
} }
.button.small {
height: 42px;
}
.button.medium-square { .button.medium-square {
padding: 0px; padding: 0px;
height: 48px; height: 48px;

View File

@ -2,8 +2,8 @@ import React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
export const Card = ({ children }) => ( export const Card = ({ children, className }) => (
<div className="card"> <div className={classNames('card', className)}>
{children} {children}
<style jsx>{` <style jsx>{`
background: white; background: white;
@ -16,6 +16,7 @@ export const Card = ({ children }) => (
Card.propTypes = { Card.propTypes = {
children: PropTypes.node, children: PropTypes.node,
className: PropTypes.string,
}; };
export const CardHeader = ({ children }) => ( export const CardHeader = ({ children }) => (
@ -53,14 +54,19 @@ CardBody.propTypes = {
children: PropTypes.node, children: PropTypes.node,
}; };
export const CardFooter = ({ children, divider = false }) => ( export const CardFooter = ({ children, divider = false, flex = false }) => (
<footer className={classNames('card-footer', { divider })}> <footer className={classNames('card-footer', { divider, flex })}>
{children} {children}
<style jsx>{` <style jsx>{`
display: flex; .card-footer {
margin: 0; display: flex;
}
&.divider { :global(.card-footer.flex > *) {
flex: 1;
}
.card-footer.divider {
border-top: 1px solid var(--gray-light); border-top: 1px solid var(--gray-light);
padding-top: var(--spacing-md); padding-top: var(--spacing-md);
} }
@ -70,6 +76,7 @@ export const CardFooter = ({ children, divider = false }) => (
CardFooter.propTypes = { CardFooter.propTypes = {
children: PropTypes.node, children: PropTypes.node,
divider: PropTypes.bool, divider: PropTypes.bool,
flex: PropTypes.bool,
}; };
export default Card; export default Card;

View File

@ -121,9 +121,9 @@ export const Modal = ({
.backdrop .modal :global(.card-footer) { .backdrop .modal :global(.card-footer) {
border-top: 0px; border-top: 0px;
display: grid; display: flex;
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); column-gap: var(--spacing-xs);
grid-column-gap: var(--spacing-sm); margin-top: var(--spacing-sm);
} }
.isVisible { .isVisible {

View File

@ -3,6 +3,7 @@ import React, { useEffect, useState } from 'react';
import { useCallState } from '../../contexts/CallProvider'; import { useCallState } from '../../contexts/CallProvider';
import { useWaitingRoom } from '../../contexts/WaitingRoomProvider'; import { useWaitingRoom } from '../../contexts/WaitingRoomProvider';
import { Button } from '../Button'; import { Button } from '../Button';
import { Card, CardBody, CardFooter } from '../Card';
export const WaitingRoomNotification = () => { export const WaitingRoomNotification = () => {
const { callObject } = useCallState(); const { callObject } = useCallState();
@ -57,35 +58,43 @@ export const WaitingRoomNotification = () => {
const handleDenyClick = () => { const handleDenyClick = () => {
denyAccess(hasMultiplePeopleWaiting ? 'all' : waitingParticipants[0].id); denyAccess(hasMultiplePeopleWaiting ? 'all' : waitingParticipants[0].id);
}; };
const handleClose = () => setShowNotification(false); // const handleClose = () => setShowNotification(false);
return ( return (
<div className="waiting-room-notification"> <Card className="waiting-room-notification">
<> <CardBody>
{hasMultiplePeopleWaiting
? `${waitingParticipants.length} people would like to join the call`
: `${waitingParticipants[0].name} would like to join the call`}
</CardBody>
<CardFooter>
{hasMultiplePeopleWaiting ? ( {hasMultiplePeopleWaiting ? (
<Button onClick={handleViewAllClick}>View all</Button> <Button onClick={handleViewAllClick} size="small" variant="success">
View all
</Button>
) : ( ) : (
<Button onClick={handleAllowClick}>Allow</Button> <Button onClick={handleAllowClick} size="small" variant="success">
Allow
</Button>
)} )}
<Button onClick={handleDenyClick} variant="secondary"> <Button onClick={handleDenyClick} size="small" variant="error">
{hasMultiplePeopleWaiting {hasMultiplePeopleWaiting ? 'Deny All' : 'Deny'}
? 'waitingRoom.denyAll'
: 'waitingRoom.deny'}
</Button> </Button>
<Button onClick={handleClose} variant="ghost"> </CardFooter>
Close
</Button>
</>
<style jsx>{` <style jsx>{`
.waiting-room-notification { :global(.waiting-room-notification) {
position: absolute; position: absolute;
right: var(--spacing-sm); right: var(--spacing-sm);
top: var(--spacing-sm); top: var(--spacing-sm);
background: red; z-index: 999;
box-shadow: var(--shadow-depth-2);
}
:global(.waiting-room-notification .card-footer) {
display: flex;
column-gap: var(--spacing-xxs);
} }
`}</style> `}</style>
</div> </Card>
); );
}; };