Skip to content

Commit 89b884c

Browse files
committed
Merge branch 'main' into completed
2 parents 58b7e7d + 454d1a0 commit 89b884c

File tree

15 files changed

+513
-0
lines changed

15 files changed

+513
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>3-0-spring-mvc</artifactId>
7+
<groupId>com.bobocode</groupId>
8+
<version>1.0-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>3-0-1-hello-spring-mvc</artifactId>
13+
14+
<dependencies>
15+
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
16+
<dependency>
17+
<groupId>org.projectlombok</groupId>
18+
<artifactId>lombok</artifactId>
19+
<version>1.18.18</version>
20+
<scope>provided</scope>
21+
</dependency>
22+
23+
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
24+
<dependency>
25+
<groupId>org.springframework.boot</groupId>
26+
<artifactId>spring-boot-starter-web</artifactId>
27+
<version>2.4.3</version>
28+
</dependency>
29+
30+
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test -->
31+
<dependency>
32+
<groupId>org.springframework.boot</groupId>
33+
<artifactId>spring-boot-starter-test</artifactId>
34+
<version>2.4.3</version>
35+
<scope>test</scope>
36+
</dependency>
37+
38+
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-thymeleaf -->
39+
<dependency>
40+
<groupId>org.springframework.boot</groupId>
41+
<artifactId>spring-boot-starter-thymeleaf</artifactId>
42+
<version>2.4.3</version>
43+
</dependency>
44+
45+
</dependencies>
46+
47+
</project>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.bobocode.mvc;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
@SpringBootApplication
7+
public class HelloSpringMvcApp {
8+
public static void main(String[] args) {
9+
SpringApplication.run(HelloSpringMvcApp.class, args);
10+
}
11+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.bobocode.mvc.api;
2+
3+
import com.bobocode.mvc.storage.Notes;
4+
import lombok.RequiredArgsConstructor;
5+
6+
@RequiredArgsConstructor
7+
public class NoteRestController {
8+
private final Notes notes;
9+
10+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.bobocode.mvc.controller;
2+
3+
import com.bobocode.mvc.storage.Notes;
4+
import lombok.RequiredArgsConstructor;
5+
import org.springframework.web.bind.annotation.RequestMapping;
6+
7+
@RequiredArgsConstructor
8+
@RequestMapping("/notes")
9+
public class NoteController {
10+
private final Notes notes;
11+
12+
13+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.bobocode.mvc.model;
2+
3+
import lombok.Data;
4+
import lombok.NoArgsConstructor;
5+
import lombok.NonNull;
6+
7+
import java.time.LocalDate;
8+
import java.util.UUID;
9+
10+
@Data
11+
@NoArgsConstructor
12+
public class Note {
13+
private UUID id;
14+
@NonNull
15+
private String title;
16+
@NonNull
17+
private String text;
18+
private LocalDate creationDate;
19+
20+
public Note(String title, String text) {
21+
this.title = title;
22+
this.text = text;
23+
}
24+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.bobocode.mvc.storage;
2+
3+
4+
import com.bobocode.mvc.model.Note;
5+
import org.springframework.stereotype.Component;
6+
7+
import java.time.LocalDate;
8+
import java.util.*;
9+
10+
@Component
11+
public class Notes {
12+
private final Map<UUID, Note> notes = new LinkedHashMap<>();
13+
14+
public List<Note> getAll(){
15+
return new ArrayList<>(notes.values());
16+
}
17+
18+
public void add(Note note) {
19+
note.setId(UUID.randomUUID());
20+
note.setCreationDate(LocalDate.now());
21+
notes.put(note.getId(), note);
22+
}
23+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.welcome {
2+
display: flex;
3+
flex-direction: column;
4+
align-items: center;
5+
justify-content: center;
6+
}
7+
8+
h1{
9+
font-size: 5em;
10+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/*color #61987e*/
2+
3+
.wrapper {
4+
width: 80%;
5+
margin: 0 auto;
6+
}
7+
8+
header {
9+
display: flex;
10+
justify-content: space-between;
11+
align-items: baseline;
12+
padding-top: 30px;
13+
padding-bottom: 15px;
14+
border-bottom: solid 1px gray;
15+
}
16+
17+
header h1 {
18+
display: block;
19+
font-size: 2em;
20+
margin-right: 80px;
21+
}
22+
23+
24+
/* Form styles */
25+
.form_block {
26+
flex: 2;
27+
display: block;
28+
background-color: white;
29+
border-radius: 4px;
30+
z-index: 98;
31+
}
32+
33+
form {
34+
display: flex;
35+
background-color: white;
36+
justify-content: space-between;
37+
align-items: baseline;
38+
z-index: 99;
39+
}
40+
41+
#title_input {
42+
flex: 1;
43+
margin: 0 10px;
44+
padding-left: 8px;
45+
border: 1px solid #61987e;
46+
border-radius: 6px;
47+
outline-color: #61987e;
48+
}
49+
50+
textarea {
51+
flex: 2;
52+
margin: 0 10px;
53+
padding-left: 8px;
54+
resize: none;
55+
border-color: #61987e;
56+
border-radius: 6px;
57+
outline-color: #61987e;
58+
}
59+
60+
.input_submit {
61+
border-style: none;
62+
outline-color: transparent;
63+
border-radius: 6px;
64+
background-color: #61987e;
65+
color: #fff;
66+
width: 100px;
67+
height: 40px;
68+
cursor: pointer;
69+
}
70+
71+
72+
/* Notes stiles */
73+
.note {
74+
margin-top: 30px;
75+
padding: 15px;
76+
border: 1px solid #f3f3f3;
77+
border-radius: 10px;
78+
box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
79+
}
80+
81+
.title_note {
82+
font-size: 1.5em;
83+
font-weight: 800;
84+
}
85+
86+
.text_note {
87+
margin-top: 20px;
88+
}
89+
90+
.date_note {
91+
margin-top: 20px;
92+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
*,
2+
*::before,
3+
*::after {
4+
box-sizing: border-box;
5+
list-style: none;
6+
}
7+
8+
ul[class],
9+
ol[class] {
10+
padding: 0;
11+
}
12+
13+
body,
14+
h1,
15+
h2,
16+
h3,
17+
h4,
18+
p,
19+
ul[class],
20+
ol[class],
21+
li,
22+
figure,
23+
figcaption,
24+
blockquote,
25+
dl,
26+
dd {
27+
margin: 0;
28+
}
29+
30+
body {
31+
min-height: 100vh;
32+
scroll-behavior: smooth;
33+
text-rendering: optimizeSpeed;
34+
line-height: 1.5;
35+
}
36+
37+
ul[class],
38+
ol[class] {
39+
list-style: none;
40+
}
41+
42+
a:not([class]) {
43+
text-decoration-skip-ink: auto;
44+
}
45+
46+
img {
47+
max-width: 100%;
48+
display: block;
49+
}
50+
51+
article > * + * {
52+
margin-top: 1em;
53+
}
54+
55+
input,
56+
button,
57+
textarea,
58+
select {
59+
font: inherit;
60+
}
61+
62+
img {
63+
display: block;
64+
}
65+
66+
@media (prefers-reduced-motion: reduce) {
67+
* {
68+
animation-duration: 0.01ms !important;
69+
animation-iteration-count: 1 !important;
70+
transition-duration: 0.01ms !important;
71+
scroll-behavior: auto !important;
72+
}
73+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@import "reset.css";
2+
@import "index.css";
3+
@import "notes.css";
4+
5+
* {
6+
font-family: 'Noto Sans HK', sans-serif;
7+
font-size: 18px;
8+
color: #373737;
9+
}

0 commit comments

Comments
 (0)