Modal (Popup) Component
A Component that contains a button to open a modal. Containing A message and a button to abort and send
This commit is contained in:
@@ -17,6 +17,7 @@ export default function Button(p) {
|
||||
let iconHTML = p.icon;
|
||||
let iconWidth = p.iconWidth, iconHeight = p.iconHeight;
|
||||
let onClick = p.onClick;
|
||||
let color = p.color;
|
||||
|
||||
//if parameters are not set, they are set to default values
|
||||
if (height == null) height = 50;
|
||||
@@ -24,6 +25,7 @@ export default function Button(p) {
|
||||
if (iconWidth == null) iconWidth = width-10;
|
||||
if (iconHeight == null) iconHeight = height-10;
|
||||
if (onClick == null) onClick = () => {};
|
||||
if (color == null) color = "#363636";
|
||||
|
||||
//build in the icon width and height to the svg tag (svg tag should not contain any size information by default)
|
||||
if (iconHTML != null) {
|
||||
@@ -38,13 +40,12 @@ export default function Button(p) {
|
||||
//return the button
|
||||
return (
|
||||
<>
|
||||
<button className={"round-border button font font-middle"}
|
||||
<button className={"round-border button font font-small"}
|
||||
style={{
|
||||
width: width,
|
||||
height: height,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center"
|
||||
justifyContent: "center",
|
||||
backgroundColor: color
|
||||
}}
|
||||
onClick={onClick}>
|
||||
{text}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import Button from "@/components/Button";
|
||||
import {useState} from "react";
|
||||
|
||||
export default function PopUp() {
|
||||
let shown = false;
|
||||
const [hidden, setHidden] = useState("none");
|
||||
|
||||
function toggleModal() {
|
||||
shown = !shown;
|
||||
setHidden(shown ? "block" : "none")
|
||||
}
|
||||
|
||||
function on_abgeben_pressed()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button text={"Abgeben"} onClick={toggleModal}/>
|
||||
|
||||
<div style={{
|
||||
display: hidden
|
||||
}}>
|
||||
|
||||
<div className={"modal-container"}>
|
||||
<div className={"modal"}>
|
||||
<p className={"font-middle"}>Kalender wirklich abgeben?</p>
|
||||
<div>
|
||||
<Button text={"Abbrechen"} color={"#363636"} onClick={toggleModal}/>
|
||||
<Button text={"Abgeben"} color={"#7a7a7a"} onClick={on_abgeben_pressed}/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -1,32 +1,16 @@
|
||||
import {Inter} from 'next/font/google'
|
||||
import React, {useState} from "react";
|
||||
import StatusBar from "@/components/StatusBar";
|
||||
import Button from "@/components/Button";
|
||||
import {arrowLeft, arrowRight} from "@/components/Icons";
|
||||
import PopUp from "@/components/PopUp";
|
||||
|
||||
const inter = Inter({subsets: ['latin']})
|
||||
|
||||
export default function Home(p) {
|
||||
|
||||
const [pr, setPr] = useState(0)
|
||||
|
||||
|
||||
return (
|
||||
<div style={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
justifyContent: "space-between",
|
||||
gap: 30
|
||||
}}>
|
||||
<Button onClick={() => {
|
||||
setPr(pr - 50)
|
||||
}} width={50} height={50} icon={arrowLeft}/>
|
||||
|
||||
<StatusBar progress={pr}/>
|
||||
|
||||
<Button onClick={() => {
|
||||
setPr(pr + 50)
|
||||
}} width={50} height={50} icon={arrowRight}/>
|
||||
</div>
|
||||
<>
|
||||
<PopUp/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -34,28 +34,30 @@ Button
|
||||
*/
|
||||
.round-border
|
||||
{
|
||||
border-radius: 10px;
|
||||
border-radius: 5px;
|
||||
border-width: 0;
|
||||
}
|
||||
|
||||
.font-small
|
||||
{
|
||||
font-size: 15px;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.font-middle
|
||||
{
|
||||
font-size: 20px ;
|
||||
font-size: 12px ;
|
||||
}
|
||||
|
||||
.font-big
|
||||
{
|
||||
font-size: 30px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.button
|
||||
{
|
||||
background-color: #0d52ce;
|
||||
background-color: #363636;
|
||||
padding: 5px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.button:hover
|
||||
@@ -124,3 +126,49 @@ Step Progress Bar
|
||||
background-color: #5d606e;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
/*
|
||||
Popup
|
||||
*/
|
||||
|
||||
.modal-container
|
||||
{
|
||||
z-index: 1;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.modal
|
||||
{
|
||||
width: 300px;
|
||||
height: 100px;
|
||||
border-radius: 10px;
|
||||
background-color: rgb(255, 255, 255);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.modal p
|
||||
{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.modal div
|
||||
{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
width: 100%;
|
||||
justify-content: end;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user