Skip to content

Commit

Permalink
Added hidden scroll to review modal
Browse files Browse the repository at this point in the history
Also added ability to specify whether or not options should appear from top or bottom in select dropdowns (now, major menu appears from the top so it doesn't spill off the window).
  • Loading branch information
mjaydenkim committed Jan 14, 2025
1 parent 6b3fe08 commit 9ffe43c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
6 changes: 4 additions & 2 deletions client/src/modules/Course/Components/MultiSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const MultiSelect = ({
value,
options,
placeholder,
onChange
onChange,
appearFromTop=false
}: SelectProps) => {
const [searchTerm, setSearchTerm] = useState<string>('');
const [open, setOpen] = useState<boolean>(false);
Expand Down Expand Up @@ -82,7 +83,7 @@ const MultiSelect = ({
/>
</div>
{open && (
<ul className={styles.options}>
<ul className={appearFromTop ? styles.gradeoptions : styles.options}>
{filteredOptions.length > 0 ? (
filteredOptions.map((option) => (
<li
Expand Down Expand Up @@ -110,6 +111,7 @@ type SelectProps = {
placeholder: string;
value: string[];
onChange: (selectedOptions: string[]) => void;
appearFromTop?: boolean;
};

export default MultiSelect;
1 change: 1 addition & 0 deletions client/src/modules/Course/Components/ReviewModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ const ReviewModal = ({
value={selectedMajors}
onChange={onMajorChange}
placeholder="Major"
appearFromTop={true}
/>
<SingleSelect
options={gradeoptions}
Expand Down
6 changes: 4 additions & 2 deletions client/src/modules/Course/Components/SingleSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const SingleSelect = ({
value,
options,
placeholder,
onChange
onChange,
appearFromTop=true
}: SelectProps) => {
const [highlightedIndex, setHighlightedIndex] = useState<number>(0);
const [open, setOpen] = useState<boolean>(false);
Expand Down Expand Up @@ -51,7 +52,7 @@ const SingleSelect = ({
/>
</div>
{open && (
<ul className={styles.gradeoptions}>
<ul className={appearFromTop ? styles.gradeoptions : styles.options}>
{options.map((option, index) => (
<li
className={`${styles.option} ${
Expand Down Expand Up @@ -79,6 +80,7 @@ type SelectProps = {
placeholder: string;
value: string;
onChange: (selectedOptions: string) => void;
appearFromTop?: boolean;
};

export default SingleSelect;
28 changes: 16 additions & 12 deletions client/src/modules/Course/Styles/ReviewModal.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@
flex-flow: column nowrap;
justify-content: center;

overflow: hidden;
overflow-y: auto;
overflow-x: hidden;
padding: 16px;
}

.modal {
width: 80%;
max-width: 900px;
max-height: 564px;
max-height: 90vh;
place-self: center;

background-color: white;
Expand All @@ -31,10 +33,15 @@

z-index: 201;
padding: 32px;
box-shadow: inset;

position: relative;
top: 0;

overflow-y: auto;
scrollbar-width: none;
}

.modal::-webkit-scrollbar {
display: none;
}

.closeicon {
Expand Down Expand Up @@ -72,20 +79,16 @@

.modal {
width: 100%;
height: 100%;
min-height: 100vh;

overflow-y: auto;

height: 100%;
bottom: 0;
overflow: auto;
border-radius: 0;
margin: 0px;

padding: 100px 32px;
margin: 0;

z-index: 100;

padding: 100px 32px;
position: fixed;
top: 0;
right: 0;
Expand Down Expand Up @@ -115,14 +118,15 @@
height: 100%;

max-width: 456px;
max-height: 100%;

place-self: center;
}

.textinputbox {
width: 100%;
height: 100%;
max-width: 456px;
max-height: 100%;
height: 355px;
border-radius: 10px;
border: 0.5px solid #65acff;
Expand Down

0 comments on commit 9ffe43c

Please sign in to comment.