modal component added

This commit is contained in:
Ruidy Nemausat 2020-02-23 00:56:02 +01:00
parent 8f7e790c70
commit 6cf52b256b
7 changed files with 40 additions and 29 deletions

View file

@ -1,4 +1,4 @@
import React, { FC } from "react"; import React, { FC, MouseEvent } from "react";
interface IProps { interface IProps {
icon?: string; icon?: string;
@ -6,18 +6,20 @@ interface IProps {
shape?: string; shape?: string;
color?: string; color?: string;
text?: string; text?: string;
onClick?: (e: MouseEvent) => void;
} }
export const Button: FC<IProps> = ({ export const Button: FC<IProps> = ({
size = "small", size = "small",
shape = "", shape = "",
color, color,
text, onClick,
children children
}) => { }) => {
return ( return (
<button <button
className={`waves-effect waves-light btn-${size} ${shape} ${color}`} className={`waves-effect waves-light btn-${size} ${shape} ${color}`}
onClick={onClick}
> >
{children} {children}
</button> </button>

View file

@ -1,20 +1,22 @@
import React, { FC } from "react"; import React, { FC, MouseEvent } from "react";
import { Button } from "./Button"; import { Button } from "./Button";
interface IProps { interface IProps {
icon?: string; icon?: string;
size?: string; size?: string;
color?: string; color?: string;
onClick?: (e: MouseEvent) => void;
} }
export const FloatingButton: FC<IProps> = ({ export const FloatingButton: FC<IProps> = ({
icon = "add", icon = "add",
size = "small", size = "small",
color = "red" color = "red",
onClick
}) => { }) => {
const iconComponent = <i className="material-icons left">{icon}</i>; const iconComponent = <i className="material-icons left">{icon}</i>;
return ( return (
<Button color={color} size={size} shape="btn-floating"> <Button color={color} size={size} shape="btn-floating" onClick={onClick}>
{iconComponent} {iconComponent}
</Button> </Button>
); );

View file

@ -0,0 +1,17 @@
import React, { FC } from "react";
export const Modal: FC = () => {
return (
<div id="modal1" className="modal">
<div className="modal-content">
<h4>Modal Header</h4>
<p>A bunch of text</p>
</div>
<div className="modal-footer">
<a href="#!" className="modal-close waves-effect waves-green btn-flat">
Agree
</a>
</div>
</div>
);
};

View file

@ -15,38 +15,24 @@ export const TicketList: FC<TicketListProps> = ({ tickets }) => {
}; };
const archiveTicket = () => {}; const archiveTicket = () => {};
const validateTicket = () => {}; const validateTicket = () => {};
const onClick: (e: MouseEvent) => void = (e: MouseEvent) => {
e.preventDefault();
};
const handleChange: (e: ChangeEvent<HTMLInputElement>) => void = ( const handleChange: (e: ChangeEvent<HTMLInputElement>) => void = (
e: ChangeEvent<HTMLInputElement> e: ChangeEvent<HTMLInputElement>
) => { ) => {
setFilterText(e.target.value); setFilterText(e.target.value);
}; };
// const useFilter = (init: string) => {
// const [filterText, setFilterText] = useState<string>(init);
// // const handleChange: (e: ChangeEvent<HTMLInputElement>) => void = (
// // e: ChangeEvent<HTMLInputElement>
// // ) => {
// // setFilterText(e.target.value);
// // };
// return {
// filterText,
// setFilterText,
// bind: {
// filterText,
// handleChange: (e: ChangeEvent<HTMLInputElement>) => {
// setFilterText(e.target.value);
// }
// }
// };
// };
// const [filterText, handleChange] = useFilter("");
// const [filterText, handleChange] = useFilter("");
return ( return (
<> <>
<div className="row valign-wrapper"> <div className="row valign-wrapper">
<h3>Tickets</h3> <h3>Tickets</h3>
<FloatingButton color=" blue-grey lighten-4" size="small" /> <FloatingButton
color=" blue-grey lighten-4"
size="small"
onClick={onClick}
/>
<FilterBar <FilterBar
filterText={filterText} filterText={filterText}
handleChange={handleChange} handleChange={handleChange}

View file

@ -19,7 +19,7 @@ export const ProjectController: FC = () => {
async function httpGet(id: string): Promise<void> { async function httpGet(id: string): Promise<void> {
try { try {
const response: HttpResponse<Project> = await get<Project>( const response: HttpResponse<Project> = await get<Project>(
`${Constants.getProjectURI}/${id}` `${Constants.projectsURI}/${id}`
); );
if (response.parsedBody !== undefined) { if (response.parsedBody !== undefined) {
setProject(response.parsedBody); setProject(response.parsedBody);

View file

@ -5,6 +5,7 @@ import { ProgressBar } from "../components/ProgressBar";
import ProjectVM from "../VM/ProjectVM"; import ProjectVM from "../VM/ProjectVM";
import { TabRouter } from "../components/TabRouter"; import { TabRouter } from "../components/TabRouter";
import { FloatingButton } from "../components/FloatingButton"; import { FloatingButton } from "../components/FloatingButton";
import { Modal } from "../components/Modal";
interface IProps { interface IProps {
viewModel: ProjectVM; viewModel: ProjectVM;
@ -23,6 +24,7 @@ export const ProjectPage: FC<IProps> = ({ viewModel }) => {
activities activities
} = viewModel; } = viewModel;
const tabNames: string[] = ["Tickets", "Files", "Activity"]; const tabNames: string[] = ["Tickets", "Files", "Activity"];
return ( return (
<div className="section"> <div className="section">
<div className="container"> <div className="container">

View file

@ -1,3 +1,5 @@
export class Constants { export class Constants {
static getProjectURI: string = "/api/v1/projects"; static projectsURI: string = "/api/v1/projects";
static ticketsURI: string = "/api/v1/tickets";
static usersURI: string = "/api/v1/users";
} }