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

[web] Drop heigh prop from Popup component #620

Merged
merged 3 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions web/package/cockpit-agama.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Jun 13 15:40:01 UTC 2023 - David Diaz <dgonzalez@suse.com>

- UI: stop using fixed sizes for modal dialogs
(gh#openSUSE/agama#620) .

-------------------------------------------------------------------
Tue Jun 13 06:59:12 UTC 2023 - David Diaz <dgonzalez@suse.com>

Expand Down
6 changes: 5 additions & 1 deletion web/src/assets/styles/utilities.scss
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,13 @@
--stack-gutter: 0;
}

.tallest {
.large {
/** block-size fallbacks **/
height: 95dvh;
width: 95dvw;
max-width: calc(var(--ui-max-inline-size) + var(--spacer-large));
/** END block-size fallbacks **/
block-size: 95dvh;
inline-size: 95dvw;
max-inline-size: calc(var(--ui-max-inline-size) + var(--spacer-large))
}
3 changes: 1 addition & 2 deletions web/src/components/core/FileViewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ export default function FileViewer({ file, title, onCloseCallback }) {
<Popup
isOpen={isOpen}
title={title || file}
variant="large"
className="tallest"
className="large"
>
{state === "loading" && <Loading text="Reading file..." />}
{(content === null || error) &&
Expand Down
5 changes: 0 additions & 5 deletions web/src/components/core/Popup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ const AncillaryAction = ({ children, ...props }) => (
* @param {boolean} [props.isOpen=false] - whether the popup is displayed or not
* @param {boolean} [props.showClose=false] - whether the popup should include a "X" action for closing it
* @param {string} [props.variant="small"] - the popup size, based on Pf4/Modal `variant` prop
* @param {string} [props.height="auto"] - the popup height, "auto", "medium", "large"
* @param {React.ReactNode} props.children - the popup content and actions
* @param {object} [pf4ModalProps] - PF4/Modal props, See {@link https://www.patternfly.org/v4/components/modal#props}
*
Expand All @@ -198,13 +197,10 @@ const Popup = ({
isOpen = false,
showClose = false,
variant = "small",
height = "auto",
children,
className,
...pf4ModalProps
}) => {
const [actions, content] = partition(React.Children.toArray(children), child => child.type === Actions);
const classesNames = [className, `${height}-modal-popup`].filter(c => c !== "").join(" ");

useLayoutEffect(() => {
/**
Expand Down Expand Up @@ -241,7 +237,6 @@ const Popup = ({
showClose={showClose}
variant={variant}
actions={actions}
className={classesNames}
>
{ content }
</Modal>
Expand Down
3 changes: 1 addition & 2 deletions web/src/components/core/Terminal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ export default function Terminal({ onCloseCallback }) {
return (
<Popup
isOpen={isOpen}
variant="large"
className="tallest"
className="large"
aria-label="terminal popup"
>

Expand Down
2 changes: 1 addition & 1 deletion web/src/components/network/IpSettingsForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export default function IpSettingsForm({ connection, onClose }) {
};

return (
<Popup isOpen height="medium" title={`Edit "${connection.name}" connection`}>
<Popup isOpen title={`Edit "${connection.name}" connection`}>
<Form id="edit-connection" onSubmit={onSubmit}>
<FormGroup fieldId="method" label="Mode" isRequired>
<FormSelect
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/network/WifiSelector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function WifiSelector({ isOpen = false, onClose }) {
});

return (
<Popup isOpen={isOpen} height="large" title="Connect to a Wi-Fi network">
<Popup isOpen={isOpen} title="Connect to a Wi-Fi network">
<WifiNetworksList
networks={networksFromValues(networks)}
hiddenNetwork={baseHiddenNetwork}
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/storage/ProposalVolumes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ const VolumeRow = ({ columns, volume, isLoading, onEdit, onDelete }) => {
</Td>
</Tr>

<Popup title="Edit file system" height="medium" isOpen={isFormOpen}>
<Popup title="Edit file system" isOpen={isFormOpen}>
<VolumeForm
id="editVolumeForm"
volume={volume}
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/storage/iscsi/DiscoverForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default function DiscoverForm({ onSubmit: onSubmitProp, onCancel }) {
const isDisabled = isLoading || !isValidForm();

return (
<Popup isOpen height="medium" title="Discover iSCSI Targets">
<Popup isOpen title="Discover iSCSI Targets">
<Form id={id} onSubmit={onSubmit}>
{ isFailed &&
<Alert variant="warning" isInline title="Something went wrong">
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/storage/iscsi/EditNodeForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function EditNodeForm({ node, onSubmit: onSubmitProp, onCancel })
const id = "iscsiEditNode";

return (
<Popup isOpen height="medium" title={`Edit ${node.target}`}>
<Popup isOpen title={`Edit ${node.target}`}>
<Form id={id} onSubmit={onSubmit}>
<FormGroup fieldId="startup" label="Startup">
<FormSelect
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/storage/iscsi/InitiatorForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function InitiatorForm({ initiator, onSubmit: onSubmitProp, onCan
const isDisabled = data.name === "";

return (
<Popup isOpen height="medium" title="Edit iSCSI Initiator">
<Popup isOpen title="Edit iSCSI Initiator">
<Form id={id} onSubmit={onSubmit}>
<FormGroup fieldId="initiatorName" label="Name" isRequired>
<TextInput
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/storage/iscsi/LoginForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function LoginForm({ node, onSubmit: onSubmitProp, onCancel }) {
const isDisabled = isLoading || !isValidAuth;

return (
<Popup isOpen height="medium" title={`Login ${node.target}`}>
<Popup isOpen title={`Login ${node.target}`}>
<Form id={id} onSubmit={onSubmit}>
{ isFailed &&
<Alert variant="warning" isInline title="Something went wrong">
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/users/FirstUser.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export default function FirstUser() {
{ isUserDefined ? <UserData user={user} actions={actions} /> : <UserNotDefined actionCb={openForm} /> }
{ /* TODO: Extract this form to a component, if possible */ }
{ isFormOpen &&
<Popup isOpen height="medium" title={isEditing ? "Edit user account" : "Create user account"}>
<Popup isOpen title={isEditing ? "Edit user account" : "Create user account"}>
<Form id="createUser" onSubmit={(e) => accept("createUser", e)}>
{ showErrors() &&
<Alert variant="warning" isInline title="Something went wrong">
Expand Down