-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #179 from djnunez-aot/cr-notes-section
Create Notes Accordion
- Loading branch information
Showing
3 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
...web/src/components/SubmissionItem/ConsultationRecord/ConsultationRecordStaffView/Note.tsx
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,32 @@ | ||
import { Box, Typography } from "@mui/material"; | ||
import { BCDesignTokens } from "epic.theme"; | ||
|
||
interface Note { | ||
id: string; | ||
note: string; | ||
created_by: string; | ||
date_created: string; | ||
} | ||
|
||
export default function Note({ note }: { note: Note }) { | ||
return ( | ||
<Box sx={{ mb: BCDesignTokens.layoutMarginMedium }}> | ||
<Box | ||
sx={{ | ||
display: "flex", | ||
justifyContent: "space-between", | ||
alignItems: "space-between", | ||
mb: BCDesignTokens.layoutMarginSmall, | ||
}} | ||
> | ||
<Typography variant="subtitle1" sx={{ fontWeight: "bold" }}> | ||
{note.created_by} | ||
</Typography> | ||
<Typography variant="subtitle1">{note.date_created}</Typography> | ||
</Box> | ||
<Typography key={note.id} variant="body1" sx={{ mb: 1 }}> | ||
{note.note} | ||
</Typography> | ||
</Box> | ||
); | ||
} |
117 changes: 117 additions & 0 deletions
117
...components/SubmissionItem/ConsultationRecord/ConsultationRecordStaffView/NotesSection.tsx
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,117 @@ | ||
import { | ||
Accordion, | ||
AccordionDetails, | ||
AccordionSummary, | ||
Box, | ||
Button, | ||
TextField, | ||
Typography, | ||
} from "@mui/material"; | ||
import KeyboardArrowRightIcon from "@mui/icons-material/KeyboardArrowRight"; | ||
import { BCDesignTokens } from "epic.theme"; | ||
import EventNoteIcon from "@mui/icons-material/EventNote"; | ||
import Note from "./Note"; | ||
import { When } from "react-if"; | ||
import { useState } from "react"; | ||
|
||
export default function NotesSection() { | ||
const mockNotes = []; | ||
const [addNote, setAddNote] = useState(false); | ||
const [expanded, setExpanded] = useState(false); | ||
|
||
const handleAddNote = () => { | ||
setAddNote(!addNote); | ||
setExpanded(true); | ||
}; | ||
|
||
return ( | ||
<Accordion | ||
disableGutters | ||
elevation={0} | ||
sx={{ | ||
borderRadius: "4px", | ||
border: `1px solid ${BCDesignTokens.themeBlue60}`, | ||
mb: BCDesignTokens.layoutMarginLarge, | ||
p: 0, | ||
}} | ||
expanded={expanded} | ||
> | ||
<AccordionSummary | ||
expandIcon={null} | ||
aria-controls="panel1-content" | ||
id="panel1-header" | ||
sx={{ | ||
py: 0, | ||
}} | ||
> | ||
<Box | ||
sx={{ | ||
display: "flex", | ||
alignItems: "space-between", | ||
justifyContent: "space-between", | ||
width: "100%", | ||
}} | ||
> | ||
<Box | ||
onClick={() => setExpanded(!expanded)} | ||
sx={{ | ||
display: "flex", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
}} | ||
> | ||
<EventNoteIcon | ||
htmlColor={BCDesignTokens.themeBlue60} | ||
fontSize={"large"} | ||
sx={{ mr: 0.5 }} | ||
/> | ||
<Typography | ||
variant="h6" | ||
sx={{ | ||
color: "#38598A", | ||
}} | ||
> | ||
View Notes | ||
</Typography> | ||
<KeyboardArrowRightIcon | ||
fontSize="medium" | ||
sx={{ ml: 0.5, color: "#38598A", p: 0 }} | ||
/> | ||
</Box> | ||
<Box onClick={handleAddNote}> | ||
<Typography | ||
variant="body1" | ||
color={BCDesignTokens.typographyColorLink} | ||
sx={{ cursor: "pointer" }} | ||
> | ||
+ Add a Note | ||
</Typography> | ||
</Box> | ||
</Box> | ||
</AccordionSummary> | ||
<AccordionDetails> | ||
<When condition={addNote}> | ||
<Box sx={{ mb: BCDesignTokens.layoutMarginMedium }}> | ||
<Typography variant="subtitle1" sx={{ fontWeight: "bold" }}> | ||
Notes | ||
</Typography> | ||
<TextField multiline fullWidth minRows={6} /> | ||
<Button sx={{ mr: BCDesignTokens.layoutMarginSmall }}> | ||
Save Note | ||
</Button> | ||
<Button color="secondary" onClick={() => setAddNote(false)}> | ||
Cancel | ||
</Button> | ||
</Box> | ||
</When> | ||
{mockNotes.length > 0 ? ( | ||
mockNotes.map((note) => <Note key={note.id} note={note} />) | ||
) : ( | ||
<Typography variant="body1" sx={{ mb: 1 }}> | ||
No notes have been added yet. | ||
</Typography> | ||
)} | ||
</AccordionDetails> | ||
</Accordion> | ||
); | ||
} |
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