Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MDS-6206] Tweak permit condition category input field sizes #3335

Merged
merged 4 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import RenderField from "@mds/common/components/forms/RenderField";
import RenderSubmitButton from "@mds/common/components/forms/RenderSubmitButton";
import { FORM } from "@mds/common/constants/forms";
import { IPermitConditionCategory } from "@mds/common/interfaces";
import { Button, Popconfirm, Row, Tooltip, Typography } from "antd";
import { Button, Col, Form, Popconfirm, Row, Tooltip, Typography } from "antd";
simensma-fresh marked this conversation as resolved.
Show resolved Hide resolved
import React, { useState } from "react";
import { Field } from "redux-form";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
Expand Down Expand Up @@ -65,59 +65,65 @@ export const EditPermitConditionCategoryInline = (props: IPermitConditionCategor

return (
<FormWrapper scrollOnToggleEdit={false} name={formName} onSubmit={handleSubmit} initialValues={props.category} isEditMode={isEditMode}>
<Row className="flex" style={{ gap: '0.5em' }}>
<Field name="step" component={RenderField} required={true} validate={[required]} />
<PermitConditionCategorySelector showLabel={false} />
<Button
className="icon-button-container"
style={{ marginRight: 0 }}
onClick={cancel}
type="primary"
icon={<FontAwesomeIcon icon={faXmark} />}
/>
<Row style={{ gap: '0.5em' }}>
<Col flex-shrink="1" style={{ maxWidth: '40px' }}>
<Field name="step" component={RenderField} required={true} validate={[required]} style={{ marginRight: 0, }} />
</Col>
<Col>
<PermitConditionCategorySelector showLabel={false} />
</Col>
<Col flex="auto" style={{ display: 'flex', gap: '0.5em' }}>
<Button
className="icon-button-container"
style={{ marginRight: 0 }}
onClick={cancel}
type="primary"
icon={<FontAwesomeIcon icon={faXmark} />}
/>

<RenderSubmitButton buttonText="" buttonProps={{ "aria-label": "Confirm", className: "icon-button-container", style: { marginRight: 0, marginLeft: 0 }, icon: <FontAwesomeIcon icon={faCheck} /> }} />
<RenderSubmitButton buttonText="" buttonProps={{ "aria-label": "Confirm", className: "icon-button-container", style: { marginRight: 0, marginLeft: 0 }, icon: <FontAwesomeIcon icon={faCheck} /> }} />

<Popconfirm
disabled={props.conditionCount > 0}
placement="topRight"
title={
<>
<Typography.Paragraph>Are you sure you want to delete {props.category.description}?</Typography.Paragraph>
<Typography.Paragraph>This action cannot be undone.</Typography.Paragraph>
</>
}
onConfirm={() => handleDelete(props.category)}
okText="Yes, Delete Category"
cancelText="No"
>
<Button
<Popconfirm
disabled={props.conditionCount > 0}
danger={true}
icon={<FontAwesomeIcon icon={faTrash} />}
aria-label="Delete Category" />
</Popconfirm>
placement="topRight"
title={
<>
<Typography.Paragraph>Are you sure you want to delete {props.category.description}?</Typography.Paragraph>
<Typography.Paragraph>This action cannot be undone.</Typography.Paragraph>
</>
}
onConfirm={() => handleDelete(props.category)}
okText="Yes, Delete Category"
cancelText="No"
>
<Button
disabled={props.conditionCount > 0}
danger={true}
icon={<FontAwesomeIcon icon={faTrash} />}
aria-label="Delete Category" />
</Popconfirm>

<Button
disabled={props.currentPosition <= 0}
onClick={(event) => {
event.stopPropagation();
props.moveUp(props.category);
}}
type="default"
aria-label="Move Category Up"
icon={<FontAwesomeIcon icon={faArrowUp} />}
/>
<Button
style={{ marginLeft: 0 }}
disabled={props.currentPosition >= props.categoryCount - 1}
aria-label="Move Category Down"
onClick={(event) => {
event.stopPropagation();
props.moveDown(props.category);
}}
icon={<FontAwesomeIcon icon={faArrowDown} />}
/>
<Button
disabled={props.currentPosition <= 0}
onClick={(event) => {
event.stopPropagation();
props.moveUp(props.category);
}}
type="default"
aria-label="Move Category Up"
icon={<FontAwesomeIcon icon={faArrowUp} />}
/>
<Button
style={{ marginLeft: 0 }}
disabled={props.currentPosition >= props.categoryCount - 1}
aria-label="Move Category Down"
onClick={(event) => {
event.stopPropagation();
props.moveDown(props.category);
}}
icon={<FontAwesomeIcon icon={faArrowDown} />}
/>
</Col>
</Row>
</FormWrapper >
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const PermitConditionCategorySelector: FC<IPermitConditionCategorySelectorProps>
const showLabel = props.showLabel !== undefined ? props.showLabel : true;

return (
<Form.Item style={{ marginRight: 0 }}>
<Form.Item style={{ marginRight: 0, minWidth: '250px' }}>
<Field
id="description"
name="description"
Expand Down
Loading