Skip to content

Commit e2253bd

Browse files
authored
feat(planner): add close button in planner settings modal (#3702)
* Add close button in planner * Removing first child styling for planner settings section
1 parent 5774b51 commit e2253bd

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

website/src/views/planner/PlannerContainer/PlannerContainer.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ export class PlannerContainerComponent extends PureComponent<Props, State> {
134134

135135
closeAddCustomData = () => this.setState({ showCustomModule: null });
136136

137+
closeSettingsModal = () => this.setState({ showSettings: false });
138+
137139
renderHeader() {
138140
const modules = [...this.props.iblocsModules, ...flatten(flatMap(this.props.modules, values))];
139141
const credits = getTotalMC(modules);
@@ -261,12 +263,8 @@ export class PlannerContainerComponent extends PureComponent<Props, State> {
261263
</div>
262264
</DragDropContext>
263265

264-
<Modal
265-
isOpen={this.state.showSettings}
266-
onRequestClose={() => this.setState({ showSettings: false })}
267-
animate
268-
>
269-
<PlannerSettings />
266+
<Modal isOpen={this.state.showSettings} onRequestClose={this.closeSettingsModal} animate>
267+
<PlannerSettings onCloseButtonClicked={this.closeSettingsModal} />
270268
</Modal>
271269

272270
<Modal

website/src/views/planner/PlannerSettings.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
@import 'variables';
33

44
.settings {
5+
display: flex;
6+
flex-direction: column;
7+
58
section {
6-
margin-bottom: 2rem;
9+
margin-bottom: 1rem;
710

811
&:last-child {
912
margin-bottom: 0;

website/src/views/planner/PlannerSettings.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
} from 'actions/planner';
1414
import ExternalLink from 'views/components/ExternalLink';
1515
import Toggle from 'views/components/Toggle';
16+
import CloseButton from 'views/components/CloseButton';
1617
import { State } from 'types/state';
1718
import styles from './PlannerSettings.scss';
1819

@@ -23,6 +24,7 @@ type Props = {
2324
readonly ignorePrereqCheck?: boolean;
2425

2526
// Actions
27+
readonly onCloseButtonClicked: () => void;
2628
readonly setMinYear: (str: string) => void;
2729
readonly setMaxYear: (str: string) => void;
2830
readonly setIBLOCs: (boolean: boolean) => void;
@@ -66,6 +68,9 @@ export const PlannerSettingsComponent: React.FC<Props> = (props) => {
6668

6769
return (
6870
<div className={styles.settings}>
71+
<div className={styles.closeButton}>
72+
<CloseButton onClick={props.onCloseButtonClicked} />
73+
</div>
6974
<section>
7075
<h2 className={styles.label}>Matriculated in</h2>
7176
<ul className={styles.years}>

0 commit comments

Comments
 (0)