Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor global CSS into component-specific stylesheets #66

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: split CourseStatus styles
injoonH committed May 12, 2024
commit 2c71b0a9633610770de3a7522c7e630bede12b85
13 changes: 7 additions & 6 deletions src/components/CountController.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Component } from 'react';
import { withTranslation } from 'react-i18next';
import PropTypes from 'prop-types';

import { appBoundClassNames as classNames } from '../common/boundClassNames';
import classNames from 'classnames';
import styles from './CountController.module.scss';

class CountController extends Component {
render() {
const { count, updateCount } = this.props;

return (
<div className={classNames('course-status--info--controller')}>
<div className={styles.controller}>
<i
className={classNames('icon', 'icon--planner-minus')}
className={classNames(styles.icon, styles.iconPlannerMinus)}
onClick={() => {
if (count > 0) {
updateCount(count - 1);
@@ -20,7 +21,7 @@ class CountController extends Component {
/>
<div>{count}</div>
<i
className={classNames('icon', 'icon--planner-plus')}
className={classNames(styles.icon, styles.iconPlannerPlus)}
onClick={() => {
updateCount(count + 1);
}}
29 changes: 29 additions & 0 deletions src/components/CountController.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.controller {
display: flex;
flex-direction: row;
justify-content: space-between;
}

.icon {
display: inline-block;

margin: calc(calc(font.$line-height-normal - 12px) / 2) 0;
width: 12px;
height: 12px;

background: none no-repeat center center;

vertical-align: top;

&PlannerPlus {
margin-left: 8px;

background-image: url(@/static/icons/plus_circled.svg);
}

&PlannerMinus {
margin-right: 8px;

background-image: url(@/static/icons/minus_circled.svg);
}
}
17 changes: 8 additions & 9 deletions src/components/CourseStatus.jsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
import React, { Component } from 'react';
import { Component } from 'react';
import PropTypes from 'prop-types';
import { withTranslation } from 'react-i18next';

import { appBoundClassNames as classNames } from '../common/boundClassNames';
import styles from './CourseStatus.module.scss';

class CourseStatus extends Component {
render() {
const { entries } = this.props;

return (
<div>
{entries.map((e) => (
<div className={classNames('course-status')} key={e.name}>
<div className={classNames('course-status--name')}>{e.name}</div>
{entries.map(({ name, info }) => (
<div className={styles.courseTypes} key={name}>
<div className={styles.title}>{name}</div>
<div>
{e.info.map((k) => (
{info.map((k) => (
<div
className={classNames('course-status--info')}
className={styles.info}
onMouseOver={k.onMouseOver}
onMouseOut={k.onMouseOut}
key={k.name}>
<div className={classNames('course-status--info--name')}>{k.name}</div>
<div />
<span className={styles.infoName}>{k.name}</span>
{k.controller}
</div>
))}
28 changes: 28 additions & 0 deletions src/components/CourseStatus.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@use '@/sass/abstracts/variables' as *;

.courseTypes:not(:last-child) {
margin-bottom: $attribute-margin-bottom + 2px;
}

.title {
margin-bottom: $attribute-margin-bottom;

font-weight: bold;
}

.info {
display: flex;
flex-direction: row;
justify-content: space-between;

margin-left: 8px;
width: calc(100% - 8px);

&:not(:last-child) {
margin-bottom: $attribute-margin-bottom;
}
}

.infoName {
align-self: center;
}
49 changes: 0 additions & 49 deletions src/sass/App.module.scss
Original file line number Diff line number Diff line change
@@ -2438,39 +2438,6 @@ a {
}
}

.course-status {
&:not(:last-child) {
margin-bottom: $attribute-margin-bottom + 2px;
}

&--name {
font-weight: bold;
margin-bottom: $attribute-margin-bottom;
}

&--info {
align-self: center;
width: calc(100% - 8px);
display: flex;
flex-direction: row;
justify-content: space-between;
margin-left: 8px;
&:not(:last-child) {
margin-bottom: $attribute-margin-bottom;
}

&--name {
align-self: center;
}

&--controller {
display: flex;
flex-direction: row;
justify-content: space-between;
}
}
}

.attribute {
display: flex;
flex-direction: row;
@@ -3309,22 +3276,6 @@ i.icon {
background-image: url(../static/icons/star_selected.svg);
}
}

&--planner-plus {
width: 12px;
height: 12px;
background-image: url(../static/icons/plus_circled.svg);
margin: calc(calc(font.$line-height-normal - 12px) / 2) 0;
margin-left: 8px;
}

&--planner-minus {
width: 12px;
height: 12px;
background-image: url(../static/icons/minus_circled.svg);
margin: calc(calc(font.$line-height-normal - 12px) / 2) 0;
margin-right: 8px;
}
}

.top-sticky {

Unchanged files with check annotations Beta

.then((response) => {
afterResponse(response.data);
})
.catch((error) => {});

Check warning on line 36 in src/common/commonOperations.js

GitHub Actions / Format and Lint

'error' is defined but never used. Allowed unused args must match /^_/u
};
export const performAddToTable = (
},
},
)
.then((response) => {

Check warning on line 79 in src/common/commonOperations.js

GitHub Actions / Format and Lint

'response' is defined but never used. Allowed unused args must match /^_/u
afterResponse();
})
.catch((error) => {});

Check warning on line 82 in src/common/commonOperations.js

GitHub Actions / Format and Lint

'error' is defined but never used. Allowed unused args must match /^_/u
}
ReactGA.event({
},
},
)
.then((response) => {

Check warning on line 118 in src/common/commonOperations.js

GitHub Actions / Format and Lint

'response' is defined but never used. Allowed unused args must match /^_/u
afterResponse();
})
.catch((error) => {});

Check warning on line 121 in src/common/commonOperations.js

GitHub Actions / Format and Lint

'error' is defined but never used. Allowed unused args must match /^_/u
}
ReactGA.event({
},
},
)
.then((response) => {

Check warning on line 150 in src/common/commonOperations.js

GitHub Actions / Format and Lint

'response' is defined but never used. Allowed unused args must match /^_/u
afterResponse();
})
.catch((error) => {});

Check warning on line 153 in src/common/commonOperations.js

GitHub Actions / Format and Lint

'error' is defined but never used. Allowed unused args must match /^_/u
}
ReactGA.event({
},
},
)
.then((response) => {

Check warning on line 182 in src/common/commonOperations.js

GitHub Actions / Format and Lint

'response' is defined but never used. Allowed unused args must match /^_/u
afterResponse();
})
.catch((error) => {});

Check warning on line 185 in src/common/commonOperations.js

GitHub Actions / Format and Lint

'error' is defined but never used. Allowed unused args must match /^_/u
}
ReactGA.event({
.then((response) => {
afterResponse(response.data, duplicateTakenItems);
})
.catch((error) => {});

Check warning on line 265 in src/common/commonOperations.js

GitHub Actions / Format and Lint

'error' is defined but never used. Allowed unused args must match /^_/u
}
};