Skip to content

Commit f2d92be

Browse files
Merge pull request #131 from sparcs-kaist/feat@redesign-banner
feat: add redesign banner
2 parents 035d8af + 585be85 commit f2d92be

File tree

4 files changed

+76
-5
lines changed

4 files changed

+76
-5
lines changed

src/common/guideline/components/Header.jsx

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@ import { connect } from 'react-redux';
55
import PropTypes from 'prop-types';
66
import { withTranslation } from 'react-i18next';
77

8-
import { guidelineBoundClassNames as classNames, appBoundClassNames } from '../../boundClassNames';
8+
import { appBoundClassNames, guidelineBoundClassNames as classNames } from '../../boundClassNames';
99

1010
import userShape from '../../../shapes/model/session/UserShape';
1111

1212
import logoImage from '../images/Services-OTL.svg';
1313

14-
import { API_URL } from '../../../const';
15-
1614
export const getFullName = (user) => {
1715
// eslint-disable-next-line no-underscore-dangle
1816
const _isKorean = (string) => {
@@ -31,9 +29,15 @@ class Header extends Component {
3129
constructor(props) {
3230
super(props);
3331

32+
const isBannerVisible = localStorage.getItem('isBannerVisible') !== 'false';
33+
if (!isBannerVisible) {
34+
document.documentElement.style.setProperty('--header-height', '55px');
35+
}
36+
3437
this.state = {
3538
isMenuOpenOnMobile: false,
3639
noBackground: false,
40+
isBannerVisible,
3741
};
3842
}
3943

@@ -84,11 +88,70 @@ class Header extends Component {
8488

8589
render() {
8690
const { t, i18n } = this.props;
87-
const { isMenuOpenOnMobile, noBackground } = this.state;
91+
const { isMenuOpenOnMobile, noBackground, isBannerVisible } = this.state;
8892
const { user } = this.props;
8993

9094
return (
9195
<header>
96+
{isBannerVisible && (
97+
<div
98+
style={{
99+
width: '100%',
100+
height: '50px',
101+
backgroundColor: '#FFFF99',
102+
display: 'flex',
103+
justifyContent: 'space-between',
104+
alignItems: 'center',
105+
}}>
106+
<div></div>
107+
<a
108+
href="/__switch/v4"
109+
style={{
110+
backgroundColor: '#FFFF99',
111+
fontWeight: 'bold',
112+
textDecoration: 'none',
113+
color: '#5f5f5f',
114+
fontSize: '20px',
115+
display: 'flex',
116+
alignItems: 'center',
117+
}}>
118+
{t('ui.button.useNewOTL')}
119+
<div
120+
style={{
121+
border: '1px #5f5f5f solid',
122+
borderRadius: '10px',
123+
marginLeft: '10px',
124+
padding: '5px',
125+
}}>
126+
{t('ui.button.move')}
127+
</div>
128+
</a>
129+
<button
130+
onClick={() => {
131+
this.setState({ isBannerVisible: false });
132+
document.documentElement.style.setProperty('--header-height', '55px');
133+
localStorage.setItem('isBannerVisible', 'false');
134+
}}
135+
style={{
136+
background: 'none',
137+
border: 'none',
138+
width: '20px',
139+
height: '20px',
140+
marginRight: '10px',
141+
cursor: 'pointer',
142+
color: '#5f5f5f',
143+
fontSize: '18px',
144+
display: 'flex',
145+
alignItems: 'center',
146+
justifyContent: 'center',
147+
zIndex: 1000,
148+
padding: 0,
149+
}}
150+
aria-label="close">
151+
152+
</button>
153+
</div>
154+
)}
92155
<div className={classNames('identity-bar')} />
93156
<div
94157
className={classNames(

src/sass/abstracts/_variables.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ $screen-height: var(
5353
100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom)
5454
);
5555

56-
$header-height: 55px;
56+
:root {
57+
--header-height: 105px;
58+
}
59+
60+
$header-height: var(--header-height);
5761
$footer-height-desktop: 50px;
5862
$footer-height-mobile: 130px;
5963
$main-image-height-desktop: 400px;

src/translations/translation.en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
"takenShort": "Taken"
5757
},
5858
"button": {
59+
"useNewOTL": "Try the new OTL!",
60+
"move": "Try",
5961
"unfix": "Unfix",
6062
"syllabus": "Syllabus",
6163
"dictionary": "Dictionary",

src/translations/translation.ko.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
"takenShort": "내가 들은"
5757
},
5858
"button": {
59+
"useNewOTL": "새로워진 OTL을 이용해보세요!",
60+
"move": "이동하기",
5961
"unfix": "고정해제",
6062
"syllabus": "실라버스",
6163
"dictionary": "과목사전",

0 commit comments

Comments
 (0)