Skip to content

Commit

Permalink
refactor: prepare react 18 upgrade - batch #2 (#3742)
Browse files Browse the repository at this point in the history
  • Loading branch information
neatbyte-vnobis committed Dec 6, 2023
1 parent ee56351 commit 2800594
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 21 deletions.
2 changes: 1 addition & 1 deletion apps/admin/src/App.editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Cognito } from "@webiny/app-admin-users-cognito";
import { Editor } from "@webiny/app-page-builder-editor";
import "./App.scss";

export const App: React.FC = () => {
export const App = () => {
return (
<Admin>
<Cognito />
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/src/App.fm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const CustomFileManager = createComponentPlugin(FileManagerRenderer, () => {
};
});

export const App: React.FC = () => {
export const App = () => {
return (
<Admin>
<Cognito />
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/src/App.okta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "./App.scss";

import { oktaFactory, rootAppClientId } from "./okta";

export const App: React.FC = () => {
export const App = () => {
return (
<Admin>
<Okta factory={oktaFactory} rootAppClientId={rootAppClientId} />
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Admin } from "@webiny/app-serverless-cms";
import { Cognito } from "@webiny/app-admin-users-cognito";
import "./App.scss";

export const App: React.FC = () => {
export const App = () => {
return (
<Admin>
<Cognito />
Expand Down
8 changes: 5 additions & 3 deletions apps/theme/layouts/forms/DefaultFormLayout/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ import { TextareaField } from "./fields/Textarea";
import { HiddenField } from "./fields/Hidden";
import { DateTimeField } from "./fields/DateTime";

interface FieldProps {
field: FormRenderFbFormModelField;
}

/**
* Renders a single form field. If needed, additional field types can be added.
*/
export const Field: React.FC<{
field: FormRenderFbFormModelField;
}> = props => {
export const Field = (props: FieldProps) => {
switch (props.field.type) {
case "text":
return <InputField {...props} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { Row } from "./Row";
import { Cell } from "./Cell";
import { ReCaptchaComponent } from "@webiny/app-page-builder-elements/renderers/form/types";

interface Props {
interface ReCaptchaSectionProps {
component: ReCaptchaComponent;
}

export const ReCaptchaSection: React.FC<Props> = ({ component: ReCaptchaComponent }) => {
export const ReCaptchaSection = ({ component: ReCaptchaComponent }: ReCaptchaSectionProps) => {
const bind = useBind({
name: "reCaptcha",
validators: validation.create("required")
Expand Down
4 changes: 2 additions & 2 deletions apps/theme/layouts/forms/DefaultFormLayout/SuccessMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ const Wrapper = styled.div`
text-align: center;
`;

interface Props {
interface SuccessMessageProps {
formData: FbFormModel;
}

export const SuccessMessage: React.FC<Props> = ({ formData }) => {
export const SuccessMessage = ({ formData }: SuccessMessageProps) => {
const heading = "Success!";

let message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ import {
} from "@webiny/app-page-builder-elements/renderers/form/types";
import styled from "@emotion/styled";

interface Props {
component: TermsOfServiceComponent;
}

const RteFieldLabel = styled(FieldLabelStyled)`
.rte-block-paragraph {
${props => props.theme.styles.typography.paragraphs.stylesById("paragraph1")};
Expand Down Expand Up @@ -59,6 +55,12 @@ export const renderCheckbox: TermsOfServiceChildrenFunction = ({
);
};

export const TermsOfServiceSection: React.FC<Props> = ({ component: TermsOfServiceComponent }) => {
interface TermsOfServiceSectionProps {
component: TermsOfServiceComponent;
}

export const TermsOfServiceSection = ({
component: TermsOfServiceComponent
}: TermsOfServiceSectionProps) => {
return <TermsOfServiceComponent>{renderCheckbox}</TermsOfServiceComponent>;
};
6 changes: 3 additions & 3 deletions apps/theme/layouts/forms/DefaultFormLayout/buttons/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ export const Wrapper = styled.div<{ fullWidth: boolean; type: "primary" | "defau
}
`;

interface Props {
interface ButtonProps {
fullWidth: boolean;
disabled: boolean;
children: React.ReactNode;
type?: "primary" | "default";
onClick: FormRenderPropParamsSubmit | (() => void);
}

export const Button: React.FC<Props> = ({
export const Button = ({
fullWidth,
disabled,
children,
type = "default",
onClick
}) => {
}: ButtonProps) => {
return (
<Wrapper fullWidth={fullWidth} type={type}>
<button className={"button-body"} onClick={onClick} disabled={disabled}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ const otherOption: Option = {
value: "other"
};

interface CheckboxProps {
interface CheckboxFieldProps {
field: FormRenderFbFormModelField;
}

export const CheckboxField: React.FC<CheckboxProps> = ({ field }) => {
export const CheckboxField = ({ field }: CheckboxFieldProps) => {
const fieldId = field.fieldId;

const { validation, value, onChange } = useBind({
Expand Down

0 comments on commit 2800594

Please sign in to comment.