Skip to content

Commit

Permalink
[#9] Add breadcrumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
dedenbangkit committed Sep 1, 2023
1 parent bf63743 commit 6341928
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 8 deletions.
6 changes: 6 additions & 0 deletions frontend/src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,10 @@
justify-content: center;
align-content: center;
}

// Akvo React Form Editor
.arfe-container {
font: inherit;
font-size: inherit;
}
}
15 changes: 13 additions & 2 deletions frontend/src/pages/forms/Editor.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React, { useState, useEffect } from "react";
import { useParams } from "react-router-dom";
import { useParams, useNavigate } from "react-router-dom";
import WebformEditor from "akvo-react-form-editor";
import "akvo-react-form-editor/dist/index.css"; /* REQUIRED */
import { api } from "../../lib";

const Editor = () => {
const { formId } = useParams();
const history = useNavigate();
const [formDef, setFormDef] = useState({});

useEffect(() => {
Expand All @@ -21,7 +22,17 @@ const Editor = () => {
};
return (
<div>
<h1>Form Editor</h1>
<h1>
<a
onClick={() => {
history("/forms");
}}
>
{" "}
Form
</a>{" "}
/ Edit / {formId}
</h1>
<WebformEditor initialValue={formDef} onSave={onSave} />
</div>
);
Expand Down
14 changes: 13 additions & 1 deletion frontend/src/pages/forms/Form.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React, { useEffect, useState, useMemo } from "react";
import { Webform } from "akvo-react-form";
import { api } from "../../lib";
import { useParams } from "react-router-dom";
import { useParams, useNavigate } from "react-router-dom";
import { Spin, notification } from "antd";

const Form = () => {
const { formId } = useParams();
const history = useNavigate();
const [formDef, setFormDef] = useState({});

useEffect(() => {
Expand Down Expand Up @@ -68,6 +69,17 @@ const Form = () => {

return (
<div>
<h1>
<a
onClick={() => {
history("/forms");
}}
>
{" "}
Form
</a>{" "}
/ Submission / {formId}
</h1>
{Object.keys(formDef).length > 0 ? (
<Webform forms={formDef} onChange={onChange} onFinish={onFinish} />
) : (
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/pages/forms/Forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@ const Forms = () => {
},
{
title: "Actions",
width: 200,
width: 300,
render: (form) => {
return (
<Row>
<Col span={12}>
<Col span={16}>
<Link to={`/form/${form.id}`}>
<Button icon={<ProfileOutlined />} type="primary" size="small">
Open
New Submission
</Button>
</Link>
</Col>
<Col span={12}>
<Col span={8}>
<Link to={`/forms/edit/${form.id}`}>
<Button icon={<FormOutlined />} type="primary" size="small">
Edit
Editor
</Button>
</Link>
</Col>
Expand Down

0 comments on commit 6341928

Please sign in to comment.