Skip to content

Commit

Permalink
chore: format code.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Apr 24, 2023
1 parent f3d25c8 commit b68b9a3
Show file tree
Hide file tree
Showing 32 changed files with 250 additions and 206 deletions.
8 changes: 4 additions & 4 deletions core/logo-rect.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
declare module 'react-login-page/logo-rect' {
import { FC } from "react";
const Logo: FC<React.SVGProps<SVGSVGElement>>
export default Logo
}
import { FC } from 'react';
const Logo: FC<React.SVGProps<SVGSVGElement>>;
export default Logo;
}
8 changes: 4 additions & 4 deletions core/logo.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
declare module 'react-login-page/logo' {
import { FC } from "react";
const Logo: FC<React.SVGProps<SVGSVGElement>>
export default Logo
}
import { FC } from 'react';
const Logo: FC<React.SVGProps<SVGSVGElement>>;
export default Logo;
}
4 changes: 2 additions & 2 deletions core/src/Block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ export const Block = <Tag extends BlockTagType = 'div'>(props: PropsWithChildren
const { name, visible = true, tagName = 'div', ...elmProps } = props;
if (ref.current !== elmProps && name) {
ref.current = { ...elmProps };
const div = (visible ? createElement(tagName, { ...elmProps }, elmProps.children) : null)
const div = visible ? createElement(tagName, { ...elmProps }, elmProps.children) : null;
dispatch({
blocks: { ...blocks, [name]: div as unknown as Blocks<'div'> },
});
}
}, [props, ref]);

return null;
}
};

Block.displayName = 'Login.Block';
2 changes: 1 addition & 1 deletion core/src/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const Input: FC<PropsWithChildren<InputProps>> = memo((props) => {
},
fields: {
...fields,
[name]: visible ? <input {...elmProps} name={rename || name} /> : null
[name]: visible ? <input {...elmProps} name={rename || name} /> : null,
},
});
}
Expand Down
21 changes: 12 additions & 9 deletions core/src/Render.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC, Fragment, Children, cloneElement, isValidElement } from 'react';
import { useStore, RenderStateProps , InitialState} from './store';
import { useStore, RenderStateProps, InitialState } from './store';

export type RenderChildren =
| { children?: (props: Required<RenderStateProps>, data: InitialState['data']) => React.ReactNode }
Expand All @@ -10,14 +10,17 @@ export const Render: FC<RenderChildren> = ({ children }) => {
const childs = typeof children === 'function' ? [] : Children.toArray(children);
return (
<Fragment>
{typeof children === 'function' && !isValidElement(children) && children({ fields, buttons, blocks, extra, $$index }, { ...data })}
{typeof children !== 'function' && childs.map((child, key) => {
if (!isValidElement(child)) return null;
return cloneElement(child, {
...child.props,
key,
});
})}
{typeof children === 'function' &&
!isValidElement(children) &&
children({ fields, buttons, blocks, extra, $$index }, { ...data })}
{typeof children !== 'function' &&
childs.map((child, key) => {
if (!isValidElement(child)) return null;
return cloneElement(child, {
...child.props,
key,
});
})}
</Fragment>
);
};
Expand Down
24 changes: 18 additions & 6 deletions core/src/logo/Logo.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
import { FC } from "react";
import { FC } from 'react';

export default function Logo(props: FC<React.SVGProps<SVGSVGElement>>) {
return (
<svg width="93" height="35" viewBox="0 0 249 95" {...props}>
<path fill="#5DCDEC" d="M64.0334432,5 C79.6854432,5 89.0164432,14.331 88.9735912,29.983 L88.9735912,66.017 C88.9735912,81.669 79.6424432,91 63.9904432,91 L27.9994432,91 C12.3474432,91 3.01644322,81.669 3.01644322,65.974 L3.01644322,29.983 C3.01644322,14.331 12.3474432,5 27.9994432,5 Z M26.5364432,20.1276427 C26.1364432,20.4476427 25.8964432,20.9276427 25.7364432,21.4876427 C25.4964432,21.9676427 25.2564432,22.6076427 25.1764432,23.2476427 C25.0964432,23.8076427 25.0164432,24.5276427 25.0164432,25.1676427 L25.0164432,70.6076427 C25.0164432,71.1676427 25.0964432,71.5676427 25.2564432,72.1276427 C25.4164432,72.6076427 25.5764432,73.2476427 25.8164432,73.8076427 C26.0564432,74.2876427 26.3764432,74.8476427 26.7764432,75.1676427 C27.4164432,75.5676427 27.9764432,75.8076427 28.7764432,75.9676427 C30.2964432,76.2876427 31.7364432,76.1276427 32.8564432,75.4076427 C34.1364432,74.6076427 34.9364432,73.2476427 35.0964432,72.0476427 C35.1764432,71.3276427 35.2564432,70.2876427 35.2564432,69.8076427 C35.2564432,68.9276427 35.3364432,68.2076427 35.3364432,67.4076427 L35.3364432,52.9276427 L36.8564432,52.9276427 C38.9364432,52.8476427 40.8564432,53.0076427 43.0964432,52.8476427 C43.8964432,52.7676427 44.7764432,52.6876427 45.6564432,52.6876427 L54.5364432,69.5676427 C55.0964432,70.7676427 55.8164432,71.8076427 56.2964432,72.6876427 C56.9364432,73.6476427 57.5764432,74.3676427 58.5364432,75.1676427 C59.1764432,75.7276427 59.8964432,76.0476427 60.7764432,76.1276427 C61.6564432,76.2876427 62.4564432,76.1276427 63.2564432,75.8876427 C63.8964432,75.6476427 64.5364432,75.3276427 65.0164432,75.0076427 C65.4964432,74.6076427 65.8964432,74.2076427 66.1364432,73.5676427 C66.2964432,73.1676427 66.3764432,72.6076427 66.2964432,72.0476427 C66.2164432,71.5676427 66.0564432,70.8476427 65.8964432,70.2076427 C65.5764432,69.6476427 65.3364432,69.0076427 65.0164432,68.4476427 C64.7764432,67.9676427 64.4564432,67.3276427 64.2164432,66.9276427 L63.4964432,65.6476427 L56.1364432,50.8476427 C56.3764432,50.7676427 56.7764432,50.6876427 57.0164432,50.5276427 C62.9364432,48.2076427 65.5764432,42.9276427 65.5764432,37.2476427 C65.5764432,32.3676427 63.5764432,27.1676427 59.8964432,23.8076427 C59.2564432,23.1676427 58.5364432,22.6876427 57.4964432,22.1276427 C56.6964432,21.7276427 55.7364432,21.3276427 54.8564432,21.0076427 C51.8964432,19.8076427 48.2164432,19.4076427 45.0964432,19.2476427 C40.4564432,19.0076427 35.6564432,19.0876427 30.9364432,19.0076427 C28.3764432,18.9276427 27.1764432,19.4876427 26.5364432,20.1276427 Z M45.6564432,29.0076427 C50.8564432,29.2476427 54.4564432,31.8076427 54.0564432,37.0876427 C53.8164432,40.6876427 50.0564432,43.5676427 46.2964432,43.5676427 L35.3364432,43.5676427 C35.3364432,37.4076427 35.4964432,33.2476427 35.3364432,28.8476427 C38.6164432,28.8476427 42.5364432,28.8476427 45.6564432,29.0076427 Z" transform="rotate(-11 45.995 48)"/>
<path fill="#4C8CF5" d="M141.033443,5 C156.685443,5 166.016443,14.331 165.973591,29.983 L165.973591,66.017 C165.973591,81.669 156.642443,91 140.990443,91 L104.999443,91 C89.3474432,91 80.0164432,81.669 80.0164432,65.974 L80.0164432,29.983 C80.0164432,14.331 89.3474432,5 104.999443,5 Z M109.607848,19 C108.727848,19 107.847848,19.24 107.127848,19.72 C106.327848,20.2 105.767848,20.84 105.447848,21.64 C104.887848,22.6 104.647848,23.64 104.567848,24.76 C104.567848,25.8 104.487848,26.92 104.407848,27.96 L104.407848,28.36 C104.327848,31.96 104.247848,34.6 104.247848,38.44 L104.247848,49.16 L104.087848,60.76 C104.087848,64.2 103.847848,67.72 104.247848,71.32 C104.247848,71.8 104.407848,72.36 104.567848,72.84 C106.247848,77.4 113.607848,76.12 117.767848,76.28 C122.167848,76.36 126.327848,76.36 130.487848,76.28 L130.807848,76.28 C132.087848,76.12 133.367848,76.12 134.567848,76.04 C135.767848,76.04 136.967848,75.8 138.167848,75.4 C139.047848,75.08 139.687848,74.68 140.247848,73.96 C140.727848,73.32 141.127848,72.52 141.127848,71.72 C141.127848,71.08 141.127848,69.88 140.967848,69.32 C140.807848,68.76 140.487848,68.28 139.847848,67.72 C139.527848,67.4 139.047848,67.08 138.407848,66.92 C137.767848,66.76 137.127848,66.6 136.327848,66.52 C135.607848,66.44 134.807848,66.36 134.167848,66.36 L130.407848,66.36 L114.567848,66.2 L114.887848,28.52 L114.887848,27.08 C114.887848,26.52 114.887848,25.88 115.047848,25.24 C115.047848,24.6 114.887848,23.96 114.807848,23.24 C114.727848,22.6 114.567848,21.96 114.407848,21.48 C114.167848,20.92 113.847848,20.44 113.527848,20.12 C112.887848,19.64 112.327848,19.24 111.687848,19.16 C111.047848,19.08 110.327848,19 109.607848,19 Z" transform="rotate(7 122.995 48)"/>
<path fill="#E15549" d="M221.033443,5 C236.685443,5 246.016443,14.331 245.973591,29.983 L245.973591,66.017 C245.973591,81.669 236.642443,91 220.990443,91 L184.999443,91 C169.347443,91 160.016443,81.669 160.016443,65.974 L160.016443,29.983 C160.016443,14.331 169.347443,5 184.999443,5 Z M188.536443,20.2969208 L188.376443,20.2969208 C186.136443,20.2969208 185.096443,20.8569208 184.616443,21.3369208 C184.216443,21.6569208 183.976443,22.1369208 183.736443,22.6169208 C183.576443,23.1769208 183.416443,23.8169208 183.256443,24.3769208 C183.176443,25.0169208 183.016443,25.6569208 183.016443,26.3769208 L183.016443,70.6169208 C183.016443,72.4569208 183.496443,73.5769208 183.896443,74.5369208 C184.536443,75.9769208 185.576443,76.4569208 187.016443,76.6969208 C188.376443,76.9369208 190.376443,76.8569208 191.496443,76.2169208 C193.130729,75.2740637 193.530321,73.5903902 193.781749,71.9419937 L193.847464,71.4938887 C193.889913,71.1965126 193.930729,70.9026351 193.976443,70.6169208 L193.976443,54.0569208 C194.376443,53.9769208 195.736443,53.9769208 196.136443,53.9769208 C198.136443,53.8969208 199.416443,53.8169208 201.656443,53.6569208 C206.616443,53.2569208 210.616443,52.6969208 214.856443,50.8569208 C220.216443,48.7769208 222.856443,44.2969208 223.256443,39.4169208 C223.656443,34.2969208 221.656443,28.7769208 217.656443,25.0169208 C216.936443,24.4569208 216.136443,23.8969208 215.336443,23.4169208 C214.536443,22.9369208 213.576443,22.5369208 212.536443,22.2169208 C211.656443,21.7369208 210.616443,21.4969208 209.736443,21.3369208 C208.776443,21.1769208 207.896443,21.0169208 206.856443,20.8569208 C205.576443,20.6969208 204.296443,20.5369208 203.016443,20.4569208 C201.816443,20.3769208 200.536443,20.2969208 199.096443,20.1369208 C196.456443,19.8169208 191.816443,20.1369208 188.536443,20.2969208 Z M193.976443,29.8169208 C194.936443,29.8169208 195.736443,29.8169208 196.216443,29.8969208 C197.416443,29.9769208 201.256443,30.0569208 202.456443,30.1369208 C207.656443,30.7769208 213.176443,33.0169208 212.856443,38.2169208 C212.296443,44.2169208 204.056443,45.0169208 198.936443,45.0969208 L193.976443,45.1769208 C193.976443,43.3369208 193.976443,41.4169208 194.056443,39.4969208 C194.056443,35.9769208 194.056443,33.0969208 193.976443,29.8169208 Z" transform="rotate(-9 202.995 48)"/>
<path
fill="#5DCDEC"
d="M64.0334432,5 C79.6854432,5 89.0164432,14.331 88.9735912,29.983 L88.9735912,66.017 C88.9735912,81.669 79.6424432,91 63.9904432,91 L27.9994432,91 C12.3474432,91 3.01644322,81.669 3.01644322,65.974 L3.01644322,29.983 C3.01644322,14.331 12.3474432,5 27.9994432,5 Z M26.5364432,20.1276427 C26.1364432,20.4476427 25.8964432,20.9276427 25.7364432,21.4876427 C25.4964432,21.9676427 25.2564432,22.6076427 25.1764432,23.2476427 C25.0964432,23.8076427 25.0164432,24.5276427 25.0164432,25.1676427 L25.0164432,70.6076427 C25.0164432,71.1676427 25.0964432,71.5676427 25.2564432,72.1276427 C25.4164432,72.6076427 25.5764432,73.2476427 25.8164432,73.8076427 C26.0564432,74.2876427 26.3764432,74.8476427 26.7764432,75.1676427 C27.4164432,75.5676427 27.9764432,75.8076427 28.7764432,75.9676427 C30.2964432,76.2876427 31.7364432,76.1276427 32.8564432,75.4076427 C34.1364432,74.6076427 34.9364432,73.2476427 35.0964432,72.0476427 C35.1764432,71.3276427 35.2564432,70.2876427 35.2564432,69.8076427 C35.2564432,68.9276427 35.3364432,68.2076427 35.3364432,67.4076427 L35.3364432,52.9276427 L36.8564432,52.9276427 C38.9364432,52.8476427 40.8564432,53.0076427 43.0964432,52.8476427 C43.8964432,52.7676427 44.7764432,52.6876427 45.6564432,52.6876427 L54.5364432,69.5676427 C55.0964432,70.7676427 55.8164432,71.8076427 56.2964432,72.6876427 C56.9364432,73.6476427 57.5764432,74.3676427 58.5364432,75.1676427 C59.1764432,75.7276427 59.8964432,76.0476427 60.7764432,76.1276427 C61.6564432,76.2876427 62.4564432,76.1276427 63.2564432,75.8876427 C63.8964432,75.6476427 64.5364432,75.3276427 65.0164432,75.0076427 C65.4964432,74.6076427 65.8964432,74.2076427 66.1364432,73.5676427 C66.2964432,73.1676427 66.3764432,72.6076427 66.2964432,72.0476427 C66.2164432,71.5676427 66.0564432,70.8476427 65.8964432,70.2076427 C65.5764432,69.6476427 65.3364432,69.0076427 65.0164432,68.4476427 C64.7764432,67.9676427 64.4564432,67.3276427 64.2164432,66.9276427 L63.4964432,65.6476427 L56.1364432,50.8476427 C56.3764432,50.7676427 56.7764432,50.6876427 57.0164432,50.5276427 C62.9364432,48.2076427 65.5764432,42.9276427 65.5764432,37.2476427 C65.5764432,32.3676427 63.5764432,27.1676427 59.8964432,23.8076427 C59.2564432,23.1676427 58.5364432,22.6876427 57.4964432,22.1276427 C56.6964432,21.7276427 55.7364432,21.3276427 54.8564432,21.0076427 C51.8964432,19.8076427 48.2164432,19.4076427 45.0964432,19.2476427 C40.4564432,19.0076427 35.6564432,19.0876427 30.9364432,19.0076427 C28.3764432,18.9276427 27.1764432,19.4876427 26.5364432,20.1276427 Z M45.6564432,29.0076427 C50.8564432,29.2476427 54.4564432,31.8076427 54.0564432,37.0876427 C53.8164432,40.6876427 50.0564432,43.5676427 46.2964432,43.5676427 L35.3364432,43.5676427 C35.3364432,37.4076427 35.4964432,33.2476427 35.3364432,28.8476427 C38.6164432,28.8476427 42.5364432,28.8476427 45.6564432,29.0076427 Z"
transform="rotate(-11 45.995 48)"
/>
<path
fill="#4C8CF5"
d="M141.033443,5 C156.685443,5 166.016443,14.331 165.973591,29.983 L165.973591,66.017 C165.973591,81.669 156.642443,91 140.990443,91 L104.999443,91 C89.3474432,91 80.0164432,81.669 80.0164432,65.974 L80.0164432,29.983 C80.0164432,14.331 89.3474432,5 104.999443,5 Z M109.607848,19 C108.727848,19 107.847848,19.24 107.127848,19.72 C106.327848,20.2 105.767848,20.84 105.447848,21.64 C104.887848,22.6 104.647848,23.64 104.567848,24.76 C104.567848,25.8 104.487848,26.92 104.407848,27.96 L104.407848,28.36 C104.327848,31.96 104.247848,34.6 104.247848,38.44 L104.247848,49.16 L104.087848,60.76 C104.087848,64.2 103.847848,67.72 104.247848,71.32 C104.247848,71.8 104.407848,72.36 104.567848,72.84 C106.247848,77.4 113.607848,76.12 117.767848,76.28 C122.167848,76.36 126.327848,76.36 130.487848,76.28 L130.807848,76.28 C132.087848,76.12 133.367848,76.12 134.567848,76.04 C135.767848,76.04 136.967848,75.8 138.167848,75.4 C139.047848,75.08 139.687848,74.68 140.247848,73.96 C140.727848,73.32 141.127848,72.52 141.127848,71.72 C141.127848,71.08 141.127848,69.88 140.967848,69.32 C140.807848,68.76 140.487848,68.28 139.847848,67.72 C139.527848,67.4 139.047848,67.08 138.407848,66.92 C137.767848,66.76 137.127848,66.6 136.327848,66.52 C135.607848,66.44 134.807848,66.36 134.167848,66.36 L130.407848,66.36 L114.567848,66.2 L114.887848,28.52 L114.887848,27.08 C114.887848,26.52 114.887848,25.88 115.047848,25.24 C115.047848,24.6 114.887848,23.96 114.807848,23.24 C114.727848,22.6 114.567848,21.96 114.407848,21.48 C114.167848,20.92 113.847848,20.44 113.527848,20.12 C112.887848,19.64 112.327848,19.24 111.687848,19.16 C111.047848,19.08 110.327848,19 109.607848,19 Z"
transform="rotate(7 122.995 48)"
/>
<path
fill="#E15549"
d="M221.033443,5 C236.685443,5 246.016443,14.331 245.973591,29.983 L245.973591,66.017 C245.973591,81.669 236.642443,91 220.990443,91 L184.999443,91 C169.347443,91 160.016443,81.669 160.016443,65.974 L160.016443,29.983 C160.016443,14.331 169.347443,5 184.999443,5 Z M188.536443,20.2969208 L188.376443,20.2969208 C186.136443,20.2969208 185.096443,20.8569208 184.616443,21.3369208 C184.216443,21.6569208 183.976443,22.1369208 183.736443,22.6169208 C183.576443,23.1769208 183.416443,23.8169208 183.256443,24.3769208 C183.176443,25.0169208 183.016443,25.6569208 183.016443,26.3769208 L183.016443,70.6169208 C183.016443,72.4569208 183.496443,73.5769208 183.896443,74.5369208 C184.536443,75.9769208 185.576443,76.4569208 187.016443,76.6969208 C188.376443,76.9369208 190.376443,76.8569208 191.496443,76.2169208 C193.130729,75.2740637 193.530321,73.5903902 193.781749,71.9419937 L193.847464,71.4938887 C193.889913,71.1965126 193.930729,70.9026351 193.976443,70.6169208 L193.976443,54.0569208 C194.376443,53.9769208 195.736443,53.9769208 196.136443,53.9769208 C198.136443,53.8969208 199.416443,53.8169208 201.656443,53.6569208 C206.616443,53.2569208 210.616443,52.6969208 214.856443,50.8569208 C220.216443,48.7769208 222.856443,44.2969208 223.256443,39.4169208 C223.656443,34.2969208 221.656443,28.7769208 217.656443,25.0169208 C216.936443,24.4569208 216.136443,23.8969208 215.336443,23.4169208 C214.536443,22.9369208 213.576443,22.5369208 212.536443,22.2169208 C211.656443,21.7369208 210.616443,21.4969208 209.736443,21.3369208 C208.776443,21.1769208 207.896443,21.0169208 206.856443,20.8569208 C205.576443,20.6969208 204.296443,20.5369208 203.016443,20.4569208 C201.816443,20.3769208 200.536443,20.2969208 199.096443,20.1369208 C196.456443,19.8169208 191.816443,20.1369208 188.536443,20.2969208 Z M193.976443,29.8169208 C194.936443,29.8169208 195.736443,29.8169208 196.216443,29.8969208 C197.416443,29.9769208 201.256443,30.0569208 202.456443,30.1369208 C207.656443,30.7769208 213.176443,33.0169208 212.856443,38.2169208 C212.296443,44.2169208 204.056443,45.0169208 198.936443,45.0969208 L193.976443,45.1769208 C193.976443,43.3369208 193.976443,41.4169208 194.056443,39.4969208 C194.056443,35.9769208 194.056443,33.0969208 193.976443,29.8169208 Z"
transform="rotate(-9 202.995 48)"
/>
</svg>
)
}
);
}
Loading

0 comments on commit b68b9a3

Please sign in to comment.