Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
React 앱 개발 연습
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
이주창
React 앱 개발 연습
Commits
60f90ea2
Commit
60f90ea2
authored
1 year ago
by
juchang Lee
Browse files
Options
Downloads
Patches
Plain Diff
folder updated
parent
68c21566
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
JS/.DS_Store
+0
-0
0 additions, 0 deletions
JS/.DS_Store
JS/MOMENTUM/css/style.css
+0
-0
0 additions, 0 deletions
JS/MOMENTUM/css/style.css
JS/MOMENTUM/index.html
+1
-2
1 addition, 2 deletions
JS/MOMENTUM/index.html
JS/MOMENTUM/js/greetings.js
+30
-0
30 additions, 0 deletions
JS/MOMENTUM/js/greetings.js
with
31 additions
and
2 deletions
JS/.DS_Store
+
0
−
0
View file @
60f90ea2
No preview for this file type
This diff is collapsed.
Click to expand it.
JS/MOMENTUM/style.css
→
JS/MOMENTUM/
css/
style.css
+
0
−
0
View file @
60f90ea2
File moved
This diff is collapsed.
Click to expand it.
JS/MOMENTUM/index.html
+
1
−
2
View file @
60f90ea2
...
...
@@ -7,7 +7,7 @@
<title>
Momentum App
</title>
</head>
<body>
<form
id=
"login-form>
<form
class=
"hidden"
id=
"login-form
"
>
<input
required
maxlength=
"15"
...
...
@@ -17,7 +17,6 @@
<input
type=
"submit"
value=
"Log In"
/>
</form>
<h1
id=
"greeting"
class=
"hidden"
></h1>
<a
href=
"https://nomadcoders.co"
>
Go to courses
</a>
<script
src=
"app.js"
></script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
JS/MOMENTUM/
app
.js
→
JS/MOMENTUM/
js/greetings
.js
+
30
−
0
View file @
60f90ea2
const
loginForm
=
document
.
querySelector
(
"
#login-form
"
);
const
loginInput
=
document
.
querySelector
(
"
#login-form input
"
);
const
greeting
=
document
.
querySelector
(
"
#greeting
"
);
const
HIDDEN_CLASSNAME
=
"
hidden
"
;
const
USERNAME_KEY
=
"
username
"
;
function
onLoginSubmit
(
event
)
{
event
.
preventDefault
();
loginForm
.
classList
.
add
(
"
hidden
"
);
loginForm
.
classList
.
add
(
HIDDEN_CLASSNAME
);
const
username
=
loginInput
.
value
;
console
.
log
(
username
);
localStorage
.
setItem
(
USERNAME_KEY
,
username
);
paintGreetings
();
}
function
handleLinkClick
(
event
)
{
event
.
preventDefault
();
const
username
=
loginInput
.
value
;
loginForm
.
classList
.
add
(
"
hidden
"
);
greeting
.
innerText
=
"
Hello
"
+
username
;
function
paintGreetings
()
{
const
username
=
localStorage
.
getItem
(
USERNAME_KEY
);
greeting
.
innerText
=
`Hello
${
username
}
`
;
greeting
.
classList
.
remove
(
HIDDEN_CLASSNAME
);
}
const
savedUsername
=
localStorage
.
getItem
(
USERNAME_KEY
);
if
(
savedUsername
===
null
){
loginForm
.
classList
.
remove
(
HIDDEN_CLASSNAME
);
loginForm
.
addEventListener
(
"
submit
"
,
onLoginSubmit
);
link
.
addEventListener
(
"
click
"
,
handleLinkClick
);
\ No newline at end of file
}
else
{
paintGreetings
();
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment