Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fahrtenbuch
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWP WS21_22 - Fahrtenbuch
Team Einhorn
fahrtenbuch
Commits
ce518177
Commit
ce518177
authored
3 years ago
by
Leander Tolksdorf
Browse files
Options
Downloads
Patches
Plain Diff
create home and book a boat page
parent
86f9a095
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
client/src/Router.tsx
+2
-1
2 additions, 1 deletion
client/src/Router.tsx
client/src/pages/Book.tsx
+122
-0
122 additions, 0 deletions
client/src/pages/Book.tsx
client/src/pages/Home.tsx
+2
-2
2 additions, 2 deletions
client/src/pages/Home.tsx
with
126 additions
and
3 deletions
client/src/Router.tsx
+
2
−
1
View file @
ce518177
import
React
from
"
react
"
;
import
{
BrowserRouter
,
Route
,
Routes
}
from
"
react-router-dom
"
;
import
UserLayout
from
"
./components/UserLayout
"
;
import
Book
from
"
./pages/Book
"
;
import
Home
from
"
./pages/Home
"
;
function
Router
()
{
...
...
@@ -11,7 +12,7 @@ function Router() {
{
/* Home page (user) */
}
<
Route
index
element
=
{
<
Home
/>
}
/>
{
/* Book a boat (user) */
}
<
Route
path
=
"book"
element
=
{
<
p
>
Book
</
p
>
}
>
<
Route
path
=
"book"
element
=
{
<
Book
/
>
}
>
{
/* After booking (user) */
}
<
Route
path
=
"success"
element
=
{
null
}
/>
</
Route
>
...
...
This diff is collapsed.
Click to expand it.
client/src/pages/Book.tsx
0 → 100644
+
122
−
0
View file @
ce518177
import
React
from
"
react
"
;
import
{
Button
,
Col
,
Container
,
Form
,
Row
}
from
"
react-bootstrap
"
;
import
{
Controller
,
useForm
}
from
"
react-hook-form
"
;
import
Divider
from
"
../components/Divider
"
;
import
Modal
from
"
../components/Modal
"
;
type
FormData
=
{
boatName
:
string
;
startTime
:
string
;
estimatedEndTime
:
string
;
destination
:
string
;
name
:
string
;
email
:
string
;
annotations
:
string
;
};
function
Book
()
{
const
{
control
,
handleSubmit
}
=
useForm
<
FormData
>
();
const
onSubmit
=
(
data
:
FormData
)
=>
console
.
log
(
data
);
return
(
<
Container
className
=
"pt-5"
>
<
Row
>
<
Col
xs
=
{
{
span
:
10
,
offset
:
1
}
}
>
<
Modal
>
<
h1
className
=
"text-center"
>
Book a Boat!
</
h1
>
<
p
className
=
"text-center"
>
Please enter the information for your booking
</
p
>
<
Divider
/>
<
Form
onSubmit
=
{
handleSubmit
(
onSubmit
)
}
>
<
Controller
name
=
"boatName"
control
=
{
control
}
render
=
{
({
field
})
=>
(
<
div
className
=
"mb-2"
>
<
Form
.
Label
>
Boat name
</
Form
.
Label
>
<
Form
.
Control
type
=
"text"
{
...
field
}
/>
</
div
>
)
}
/>
<
Controller
name
=
"startTime"
control
=
{
control
}
render
=
{
({
field
})
=>
(
<
div
className
=
"mb-2"
>
<
Form
.
Label
>
Start time
</
Form
.
Label
>
<
Form
.
Control
type
=
"text"
{
...
field
}
/>
</
div
>
)
}
/>
<
Controller
name
=
"estimatedEndTime"
control
=
{
control
}
render
=
{
({
field
})
=>
(
<
div
className
=
"mb-2"
>
<
Form
.
Label
>
Estimated end time
</
Form
.
Label
>
<
Form
.
Control
type
=
"text"
{
...
field
}
/>
</
div
>
)
}
/>
<
Controller
name
=
"destination"
control
=
{
control
}
render
=
{
({
field
})
=>
(
<
div
className
=
"mb-2"
>
<
Form
.
Label
>
Destination
</
Form
.
Label
>
<
Form
.
Control
type
=
"text"
{
...
field
}
/>
</
div
>
)
}
/>
<
Controller
name
=
"name"
control
=
{
control
}
render
=
{
({
field
})
=>
(
<
div
className
=
"mb-2"
>
<
Form
.
Label
>
Destination
</
Form
.
Label
>
<
Form
.
Control
type
=
"text"
{
...
field
}
/>
</
div
>
)
}
/>
<
Controller
name
=
"email"
control
=
{
control
}
render
=
{
({
field
})
=>
(
<
div
className
=
"mb-2"
>
<
Form
.
Label
>
Your Mail
</
Form
.
Label
>
<
Form
.
Control
type
=
"email"
{
...
field
}
/>
</
div
>
)
}
/>
<
Controller
name
=
"name"
control
=
{
control
}
render
=
{
({
field
})
=>
(
<
div
className
=
"mb-2"
>
<
Form
.
Label
>
Your Name
</
Form
.
Label
>
<
Form
.
Control
type
=
"text"
{
...
field
}
/>
</
div
>
)
}
/>
<
Controller
name
=
"annotations"
control
=
{
control
}
render
=
{
({
field
})
=>
(
<
div
className
=
"mb-2"
>
<
Form
.
Label
>
Annotations (optional)
</
Form
.
Label
>
<
Form
.
Control
as
=
"textarea"
type
=
"text"
{
...
field
}
/>
</
div
>
)
}
/>
<
Button
type
=
"submit"
variant
=
"secondary"
className
=
"mt-2 w-100"
>
Book this boat!
</
Button
>
</
Form
>
</
Modal
>
</
Col
>
</
Row
>
</
Container
>
);
}
export
default
Book
;
This diff is collapsed.
Click to expand it.
client/src/pages/Home.tsx
+
2
−
2
View file @
ce518177
...
...
@@ -9,9 +9,9 @@ function Home() {
<
Row
className
=
"h-100"
>
<
Col
xs
=
{
{
span
:
8
,
offset
:
2
}
}
className
=
"h-100 py-5 text-center d-flex flex-column justify-content-between"
className
=
"h-100 py-5 text-center d-flex flex-column justify-content-between
rounded-xl
"
>
<
Image
src
=
{
logo
}
className
=
"mb-5"
/>
<
Image
src
=
{
logo
}
fluid
className
=
"mb-5"
/>
<
div
>
<
Link
to
=
"/book"
>
<
Button
...
...
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