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

fix: adjust forms #3473

Merged
merged 8 commits into from
Nov 18, 2024
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.
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 @@ -33,7 +33,7 @@ export function AlertRenderer({

let schemaType = 'Information';
if (severity === 'warning') {
schemaType = 'Warning';
schemaType = 'Critical';
} else if (severity === 'error') {
schemaType = 'Negative';
} else if (severity === 'success') {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Extensibility/components/Alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const Alert = ({ value, schema, structure, ...props }) => {

let schemaType = 'Information';
if (structure.severity === 'warning') {
schemaType = 'Warning';
schemaType = 'Critical';
} else if (structure.severity === 'error') {
schemaType = 'Negative';
} else if (structure.severity === 'success') {
Expand Down
1 change: 1 addition & 0 deletions src/components/KymaModules/KymaModulesAddModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ export default function KymaModulesAddModule({
initialUnchangedResource={initialUnchangedResource}
afterCreatedCustomMessage={t('kyma-modules.module-added')}
formWithoutPanel
className="add-modules-form"
>
{modulesAddData?.length !== 0 ? (
<>
Expand Down
4 changes: 4 additions & 0 deletions src/components/KymaModules/KymaModulesAddModule.scss
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@
}
}

.add-modules-form::part(layout) {
background-color: var(--sapBackgroundColor);
}

@container (max-width: 350px) {
.gridbox-addModule {
--card-width: 300px;
Expand Down
1 change: 1 addition & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import '@ui5/webcomponents-icons-tnt/dist/network.js';
import '@ui5/webcomponents-icons-tnt/dist/application.js';
import '@ui5/webcomponents-icons-tnt/dist/application-service.js';
import '@sap-ui/common-css/dist/sap-margin.css';
import '@sap-ui/common-css/dist/sap-padding.css';

import './styles/reset.css';
import './styles/sapIllus-Fills.css';
Expand Down
2 changes: 1 addition & 1 deletion src/shared/ResourceForm/components/Presets.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function Presets({
return inlinePresets ? (
presetDropdown
) : (
<div className="ui5-content-density-compact preset-separator sap-margin-y-tiny sap-padding-x-small">
<div className="ui5-content-density-compact preset-separator sap-margin-y-tiny">
{presetDropdown}
</div>
);
Expand Down
1 change: 1 addition & 0 deletions src/shared/ResourceForm/components/Presets.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.resource-form {
.preset-separator {
border-bottom: 1px solid var(--sapList_GroupHeaderBorderColor);
padding-bottom: 1rem;
}
}
5 changes: 5 additions & 0 deletions src/shared/ResourceForm/components/ResourceForm.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ form .resource-form {
ui5-form-item::part(layout) {
grid-template-columns: none;
}

&::part(layout) {
padding: 0;
}

form {
overflow: hidden;
flex-grow: 1;
Expand Down
4 changes: 2 additions & 2 deletions src/shared/ResourceForm/inputs/Text.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useValidation } from 'shared/hooks/useValidation';
import { Input } from '@ui5/webcomponents-react';

export function Text(props) {
return <WrappedText {...props} />;
export function Text({ key, ...props }) {
return <WrappedText key={key} {...props} />;
}

export function WrappedText({ value, setValue, onChange, inputRef, ...props }) {
Expand Down
19 changes: 16 additions & 3 deletions src/shared/components/ResourcesList/ResourcesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,19 @@ export function ResourcesList({
return <></>; // wait for the context update
}

const allProps = {
customHeaderActions,
resourceUrl,
resourceType,
resourceTitle,
isCompact,
description,
layoutNumber,
resources,
filterFn,
...props,
};

const content = (
<>
<BannerCarousel
Expand All @@ -106,10 +119,10 @@ export function ResourcesList({
{resources ? (
<ResourceListRenderer
resources={(resources || []).filter(filterFn)}
{...props}
{...allProps}
/>
) : (
<Resources {...props} />
<Resources {...allProps} />
)}
</>
);
Expand Down Expand Up @@ -169,9 +182,9 @@ function Resources(props) {
<ResourceListRenderer
loading={loading}
error={error}
resources={filter ? (resources || []).filter(filter) : resources || []}
silentRefetch={silentRefetch}
{...props}
resources={filter ? (resources || []).filter(filter) : resources || []}
/>
);
}
Expand Down
25 changes: 4 additions & 21 deletions src/shared/components/UnsavedMessageBox/UnsavedMessageBox.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import {
Button,
ButtonDomRef,
ButtonPropTypes,
MessageBox,
WithWebComponentPropTypes,
} from '@ui5/webcomponents-react';
import { Button, MessageBox } from '@ui5/webcomponents-react';
import { useTranslation } from 'react-i18next';
import { ForwardRefExoticComponent, RefAttributes } from 'react';
import { useRecoilState } from 'recoil';
import { isResourceEditedState } from 'state/resourceEditedAtom';
import { isFormOpenState } from 'state/formOpenAtom';
Expand All @@ -22,23 +15,13 @@ export function UnsavedMessageBox({ isOpen }: UnsavedMessageBoxProps) {
);
const [isFormOpen, setIsFormOpen] = useRecoilState(isFormOpenState);

const handleClose = (event: {
detail: {
action:
| string
| ForwardRefExoticComponent<
ButtonPropTypes &
WithWebComponentPropTypes &
RefAttributes<ButtonDomRef>
>;
};
}) => {
if (event.detail.action === '0: custom action') {
const handleClose = (action, escapedPressed) => {
if (action === '0: custom action' || escapedPressed) {
if (isResourceEdited.discardAction) {
isResourceEdited.discardAction();
}
setIsFormOpen({ formOpen: false, leavingForm: false });
} else if (event.detail.action === '1: custom action') {
} else if (action === '1: custom action') {
setIsResourceEdited({ isEdited: true });
setIsFormOpen({ formOpen: true, leavingForm: false });
return;
Expand Down
86 changes: 4 additions & 82 deletions src/styles/reset.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,94 +3,16 @@
License: none (public domain)
*/

/* html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
html,
ul {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
} */
}
*/
/* HTML5 display-role reset for older browsers */
article,
aside,
Expand Down
Loading