-
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.
Pax Components and Styles, 1.6.0 Release, introducing mui-x --------- Co-authored-by: jackson <Jackson Hyde>
- Loading branch information
1 parent
8a39db6
commit 4398ba1
Showing
48 changed files
with
1,568 additions
and
132 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import * as React from 'react'; | ||
import { PaxCard as PaxCardComponent } from './PaxCard'; | ||
import { PaxTimeRange } from './PaxCard'; | ||
|
||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { Stack } from '@mui/material'; | ||
|
||
const meta: Meta<typeof PaxCardComponent> = { | ||
title: "DRT Components/Features/Pax/PaxCard", | ||
component: PaxCardComponent, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof PaxCardComponent>; | ||
|
||
const startTime1 = new Date(); | ||
const startTime2 = new Date(); | ||
const startTime3 = new Date(); | ||
const endTime1 = new Date(); | ||
const endTime2 = new Date(); | ||
const endTime3 = new Date(); | ||
|
||
const queues = [ | ||
{ queueName: 'EEA', queueCount: 77 }, | ||
{ queueName: 'Non-EEA', queueCount: 128 }, | ||
{ queueName: 'EEA', queueCount: 213 } | ||
] | ||
|
||
|
||
startTime1.setHours(11, 26); | ||
endTime1.setHours(11, 26); | ||
|
||
startTime2.setHours(11, 26); | ||
endTime2.setHours(11, 31); | ||
|
||
startTime3.setHours(11, 31); | ||
endTime3.setHours(11, 36); | ||
|
||
export const PaxCardSingle:Story = { | ||
args: { | ||
queues: queues, | ||
timeRange: PaxTimeRange.Next5Mins, | ||
startTime: startTime1, | ||
endTime: endTime1 | ||
} | ||
} | ||
|
||
export const PaxCardGroup: Story = { | ||
render: () => { | ||
return ( | ||
<Stack | ||
spacing={2} | ||
direction={'row'} | ||
display="inline-flex" | ||
sx={(theme) => ({ | ||
p:2, | ||
backgroundColor: theme.palette.secondary.light || theme.palette.grey[200] | ||
})}> | ||
<PaxCardComponent | ||
queues={queues} | ||
timeRange={PaxTimeRange.Next5Mins} | ||
startTime={startTime1} | ||
endTime={endTime1} | ||
/> | ||
<PaxCardComponent | ||
queues={queues} | ||
timeRange={PaxTimeRange.Next5to10Mins} | ||
startTime={startTime2} | ||
endTime={endTime2} | ||
/> | ||
<PaxCardComponent | ||
queues={queues} | ||
timeRange={PaxTimeRange.Next10to15Mins} | ||
startTime={startTime3} | ||
endTime={endTime3} | ||
/> | ||
</Stack> | ||
) | ||
} | ||
}; |
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,81 @@ | ||
import { BorderBottom } from '@mui/icons-material'; | ||
import { Paper, styled, Theme, Typography, Table, TableHead, TableRow, TableCell, TableBody } from '@mui/material'; | ||
import * as React from 'react'; | ||
|
||
|
||
export enum PaxTimeRange { | ||
Next5Mins = 'Next 5 Mins', | ||
Next5to10Mins = 'Next 5 to 10 Mins', | ||
Next10to15Mins = 'Next 10 to 15 Mins', | ||
} | ||
|
||
export type PortQueue = { | ||
queueName: string, | ||
queueCount: number | ||
} | ||
|
||
export interface IPaxCard { | ||
queues: PortQueue[], | ||
timeRange: PaxTimeRange, | ||
startTime: Date, | ||
endTime: Date, | ||
} | ||
|
||
const StyledPaxCard = styled(Paper)(({theme} : {theme: Theme}) => ({ | ||
display: 'inline-block', | ||
padding: theme.spacing(2), | ||
backgroundColor: theme.palette.grey[100], | ||
'.MuiTableCell-root': { | ||
backgroundColor: theme.palette.background.default, | ||
color: theme.palette.common.black, | ||
padding: `${theme.spacing(1)} ${theme.spacing(0)}` | ||
}, | ||
'& .MuiTableRow-root :first-child': { | ||
paddingRight: theme.spacing(1) | ||
}, | ||
'& .MuiTableCell-head': { | ||
borderBottom: `1px solid ${theme.palette.common.black}`, | ||
}, | ||
'& .MuiTableBody-root .MuiTableCell-root': { | ||
borderBottom: 'none !important', | ||
} | ||
})); | ||
|
||
const formatTime = (datetime:Date) => { | ||
return `${datetime.getHours()}:${datetime.getMinutes()}` | ||
} | ||
|
||
export const PaxCard = ({queues, timeRange, startTime, endTime}: IPaxCard) => { | ||
|
||
|
||
return ( | ||
<StyledPaxCard elevation={0}> | ||
<Typography variant='h5'>{timeRange}</Typography> | ||
<Typography variant='body1'> | ||
{`(${formatTime(startTime)} to ${formatTime(endTime)})`} | ||
</Typography> | ||
<Paper elevation={0} sx={{mt: 1, px: 1}}> | ||
<Table> | ||
<TableHead> | ||
<TableRow> | ||
<TableCell>Estimated pax:</TableCell> | ||
<TableCell align='right'>{ queues.reduce((sum, q) => sum + q.queueCount, 0)}</TableCell> | ||
</TableRow> | ||
</TableHead> | ||
<TableBody> | ||
{ | ||
queues.map((queue) => { | ||
return ( | ||
<TableRow key={queue.queueName}> | ||
<TableCell>{`${queue.queueName}:`}</TableCell> | ||
<TableCell align='right'>{ queue.queueCount }</TableCell> | ||
</TableRow> | ||
) | ||
}) | ||
} | ||
</TableBody> | ||
</Table> | ||
</Paper> | ||
</StyledPaxCard> | ||
) | ||
} |
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,2 @@ | ||
export { PaxCard } from "./PaxCard"; | ||
export type { IPaxCard, PaxTimeRange, PortQueue } from "./PaxCard"; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.