From afd0a878822c1874b0ea68a7968364389e0c943f Mon Sep 17 00:00:00 2001 From: Movin Silva Date: Fri, 10 May 2024 15:09:11 +0530 Subject: [PATCH 01/14] feat(auth-components): :sparkles: enhance subtitle support for typography --- .../SignInTypography/SignInTypography.tsx | 6 ++++-- .../SignInTypography/sign-in-typography.scss | 21 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 packages/react/src/oxygen-ui-react-auth-components/SignInTypography/sign-in-typography.scss diff --git a/packages/react/src/oxygen-ui-react-auth-components/SignInTypography/SignInTypography.tsx b/packages/react/src/oxygen-ui-react-auth-components/SignInTypography/SignInTypography.tsx index 7e951f8b..590b8231 100644 --- a/packages/react/src/oxygen-ui-react-auth-components/SignInTypography/SignInTypography.tsx +++ b/packages/react/src/oxygen-ui-react-auth-components/SignInTypography/SignInTypography.tsx @@ -20,6 +20,7 @@ import {Typography, TypographyProps} from '@oxygen-ui/react'; import clsx from 'clsx'; import {ElementType, ForwardRefExoticComponent, MutableRefObject, ReactElement, forwardRef} from 'react'; import {WithWrapperProps} from '../models/component'; +import './sign-in-typography.scss'; export type SignInTypographyProps = { component?: C; @@ -32,7 +33,7 @@ const SignInTypography: ForwardRefExoticComponent & WithW (props: SignInTypographyProps, ref: MutableRefObject): ReactElement => { const {className, title, subtitle, variant, align, ...rest} = props; - const classes: string = clsx(`Oxygen${COMPONENT_NAME}`, className); + let classes: string = clsx(`Oxygen${COMPONENT_NAME}`, className); let extendedVariant: string = variant || 'body1'; let extendedAlign: string = align || 'left'; @@ -42,6 +43,7 @@ const SignInTypography: ForwardRefExoticComponent & WithW extendedVariant = 'h5'; } else if (subtitle) { extendedVariant = 'body1'; + classes = clsx(classes, `Oxygen${COMPONENT_NAME}-subtitle`); } } @@ -51,7 +53,7 @@ const SignInTypography: ForwardRefExoticComponent & WithW } } - return ; + return ; }, ) as ForwardRefExoticComponent & WithWrapperProps; diff --git a/packages/react/src/oxygen-ui-react-auth-components/SignInTypography/sign-in-typography.scss b/packages/react/src/oxygen-ui-react-auth-components/SignInTypography/sign-in-typography.scss new file mode 100644 index 00000000..ae3a72de --- /dev/null +++ b/packages/react/src/oxygen-ui-react-auth-components/SignInTypography/sign-in-typography.scss @@ -0,0 +1,21 @@ +/** + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +.OxygenSignInTypography-subtitle { + color: grey; +} From f3ddfb8413e3a062553e8a4aa45fb19c4323499b Mon Sep 17 00:00:00 2001 From: Movin Silva Date: Fri, 10 May 2024 16:48:32 +0530 Subject: [PATCH 02/14] feat(auth-components): :sparkles: add prop support for SignIn component --- .../SignIn/SignIn.tsx | 52 +++++++++++++++++-- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx b/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx index 726e995a..d0aeee5b 100644 --- a/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx +++ b/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx @@ -21,15 +21,20 @@ import clsx from 'clsx'; import {ElementType, ForwardRefExoticComponent, MutableRefObject, ReactElement, forwardRef} from 'react'; import {WithWrapperProps} from '../models/component'; import SignInAlert from '../SignInAlert/SignInAlert'; -import SignInButton from '../SignInButton/SignInButton'; +import SignInButton, {SignInButtonProps} from '../SignInButton/SignInButton'; import SignInDivider from '../SignInDivider/SignInDivider'; -import SignInLink from '../SignInLink/SignInLink'; +import SignInLink, {SignInLinkProps} from '../SignInLink/SignInLink'; import SignInPaper from '../SignInPaper/SignInPaper'; -import SignInTextField from '../SignInTextField/SignInTextField'; +import SignInTextField, {SignInTextFieldProps} from '../SignInTextField/SignInTextField'; import SignInTypography from '../SignInTypography/SignInTypography'; export type SignInProps = { component?: C; + links: SignInLinkProps[]; + loginOptions?: SignInButtonProps[]; + subtitle?: string; + textFields?: SignInTextFieldProps[]; + title?: string; } & Omit; type SignInCompoundProps = { @@ -44,12 +49,51 @@ type SignInCompoundProps = { const COMPONENT_NAME: string = 'SignIn'; +const renderTextFields = (textFields: SignInTextFieldProps[]): ReactElement[] => + textFields.map((textFieldProps: SignInTextFieldProps) => ); + +const renderLinks = (links: SignInLinkProps[]): ReactElement[] => + links.map((linkProps: SignInLinkProps) => ( + <> + +
+ + )); + +const renderLoginOptions = (loginOptions: SignInButtonProps[]): ReactElement[] => + loginOptions.map((loginOptionProps: SignInButtonProps) => ); + const SignIn: ForwardRefExoticComponent & WithWrapperProps & SignInCompoundProps = forwardRef( (props: SignInProps, ref: MutableRefObject): ReactElement => { - const {className, ...rest} = props; + const {className, title, subtitle, textFields, links, loginOptions, ...rest} = props; const classes: string = clsx(`Oxygen${COMPONENT_NAME}`, className); + if (title || subtitle || textFields || links || loginOptions) { + return ( + + + {title && {title}} + + {subtitle && {subtitle}} + + {textFields && renderTextFields(textFields)} + + Sign In + + {links && renderLinks(links)} + + {loginOptions && ( + <> + OR + {renderLoginOptions(loginOptions)} + + )} + + + ); + } + return ; }, ) as ForwardRefExoticComponent & WithWrapperProps & SignInCompoundProps; From 1686759f9a64217ec7290bdf6083c1a7a08b64df Mon Sep 17 00:00:00 2001 From: Movin Silva Date: Fri, 10 May 2024 17:42:57 +0530 Subject: [PATCH 03/14] feat(auth-components): :sparkles: add SignInPinInput component --- .../SignIn/SignIn.tsx | 19 ++- .../SignInPinInput/SignInPinInput.tsx | 126 ++++++++++++++++++ .../SignInPinInput/sign-in-pin-input.scss | 37 +++++ 3 files changed, 176 insertions(+), 6 deletions(-) create mode 100644 packages/react/src/oxygen-ui-react-auth-components/SignInPinInput/SignInPinInput.tsx create mode 100644 packages/react/src/oxygen-ui-react-auth-components/SignInPinInput/sign-in-pin-input.scss diff --git a/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx b/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx index d0aeee5b..b1f98b33 100644 --- a/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx +++ b/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx @@ -25,12 +25,13 @@ import SignInButton, {SignInButtonProps} from '../SignInButton/SignInButton'; import SignInDivider from '../SignInDivider/SignInDivider'; import SignInLink, {SignInLinkProps} from '../SignInLink/SignInLink'; import SignInPaper from '../SignInPaper/SignInPaper'; +import SignInPinInput from '../SignInPinInput/SignInPinInput'; import SignInTextField, {SignInTextFieldProps} from '../SignInTextField/SignInTextField'; import SignInTypography from '../SignInTypography/SignInTypography'; export type SignInProps = { component?: C; - links: SignInLinkProps[]; + links?: SignInLinkProps[]; loginOptions?: SignInButtonProps[]; subtitle?: string; textFields?: SignInTextFieldProps[]; @@ -43,6 +44,7 @@ type SignInCompoundProps = { Divider: typeof SignInDivider; Link: typeof SignInLink; Paper: typeof SignInPaper; + PinInput: typeof SignInPinInput; TextField: typeof SignInTextField; Typography: typeof SignInTypography; }; @@ -50,18 +52,22 @@ type SignInCompoundProps = { const COMPONENT_NAME: string = 'SignIn'; const renderTextFields = (textFields: SignInTextFieldProps[]): ReactElement[] => - textFields.map((textFieldProps: SignInTextFieldProps) => ); + textFields.map((textFieldProps: SignInTextFieldProps, index: number) => ( + + )); const renderLinks = (links: SignInLinkProps[]): ReactElement[] => - links.map((linkProps: SignInLinkProps) => ( - <> + links.map((linkProps: SignInLinkProps, index: number) => ( +

- +
)); const renderLoginOptions = (loginOptions: SignInButtonProps[]): ReactElement[] => - loginOptions.map((loginOptionProps: SignInButtonProps) => ); + loginOptions.map((loginOptionProps: SignInButtonProps, index: number) => ( + + )); const SignIn: ForwardRefExoticComponent & WithWrapperProps & SignInCompoundProps = forwardRef( (props: SignInProps, ref: MutableRefObject): ReactElement => { @@ -108,5 +114,6 @@ SignIn.Divider = SignInDivider; SignIn.Link = SignInLink; SignIn.Button = SignInButton; SignIn.TextField = SignInTextField; +SignIn.PinInput = SignInPinInput; export default SignIn; diff --git a/packages/react/src/oxygen-ui-react-auth-components/SignInPinInput/SignInPinInput.tsx b/packages/react/src/oxygen-ui-react-auth-components/SignInPinInput/SignInPinInput.tsx new file mode 100644 index 00000000..d6b3940f --- /dev/null +++ b/packages/react/src/oxygen-ui-react-auth-components/SignInPinInput/SignInPinInput.tsx @@ -0,0 +1,126 @@ +/** + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import {Box, BoxProps, TextField, TextFieldProps} from '@oxygen-ui/react'; +import clsx from 'clsx'; +import React, { + useState, + useRef, + useEffect, + MutableRefObject, + ForwardRefExoticComponent, + forwardRef, + ElementType, + ReactElement, +} from 'react'; +import {WithWrapperProps} from '../models/component'; +import './sign-in-pin-input.scss'; + +const COMPONENT_NAME: string = 'SignInPinInput'; + +export type SignInPinInputProps = { + component?: C; + itemProps?: TextFieldProps; + length: number; + onPinChange?: (pin: string) => void; +} & Omit; + +const SignInPinInput: ForwardRefExoticComponent & WithWrapperProps = forwardRef( + (props: SignInPinInputProps, ref: MutableRefObject): ReactElement => { + const {length, onPinChange, className, itemProps, ...rest} = props; + + const classes: string = clsx(`Oxygen${COMPONENT_NAME}`, className); + + const [totp, setTotp] = useState(Array(length).fill('')); // Initialize a state variable for the TOTP + + const refs: MutableRefObject[]> = useRef( + totp.map(() => React.createRef()), + ); + + useEffect(() => { + /** + * If all fields are filled, call onPinChange + */ + if (onPinChange && totp.every((value: string) => value !== '')) { + onPinChange(totp.join('')); + } + }, [totp, onPinChange]); + + const handleChange = (index: number) => (event: React.ChangeEvent) => { + const newTotp: string[] = [...totp]; + newTotp[index] = event.target.value; + setTotp(newTotp); + + /** + * If a character is entered and there's a next TextField, focus it + */ + if (event.target.value && index < totp.length - 1) { + refs.current[index + 1].current?.focus(); + } + }; + + const handleKeyDown = (index: number) => (event: React.KeyboardEvent) => { + /** + * If the backspace key is pressed and the current field is empty + */ + if (event.key === 'Backspace' && totp[index] === '') { + /** + * Prevent the default action to stop deleting characters in the previous field + */ + event.preventDefault(); + + /** + * If there's a previous field, focus it + */ + if (index > 0) { + refs.current[index - 1].current?.focus(); + + /** + * Clear the value of the previous field + */ + const newTotp: string[] = [...totp]; + newTotp[index - 1] = ''; + setTotp(newTotp); + } + } + }; + + return ( + + {[...Array(length)].map((_: number, index: number) => ( + + ))} + + ); + }, +) as ForwardRefExoticComponent & WithWrapperProps; + +SignInPinInput.muiName = COMPONENT_NAME; +export default SignInPinInput; diff --git a/packages/react/src/oxygen-ui-react-auth-components/SignInPinInput/sign-in-pin-input.scss b/packages/react/src/oxygen-ui-react-auth-components/SignInPinInput/sign-in-pin-input.scss new file mode 100644 index 00000000..121aae46 --- /dev/null +++ b/packages/react/src/oxygen-ui-react-auth-components/SignInPinInput/sign-in-pin-input.scss @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +.OxygenSignInPinInput { + display: flex; + flex-flow: row nowrap; + align-content: center; + justify-content: center; + align-items: center; + gap: 12px; + text-align: center; + margin: 16px 0; + + .MuiInputBase-input { + text-align: center; + } + + input { + padding: 16px 0; + width: 45px; + } +} From ee52fd0adc7f8418c20f67ecd635955f56855d88 Mon Sep 17 00:00:00 2001 From: Movin Silva Date: Sat, 11 May 2024 09:11:47 +0530 Subject: [PATCH 04/14] feat(auth-components): :sparkles: add SignInImage component --- .../SignIn/SignIn.tsx | 3 ++ .../SignInImage/SignInImage.tsx | 41 +++++++++++++++++++ .../SignInImage/sign-in-image.scss | 22 ++++++++++ 3 files changed, 66 insertions(+) create mode 100644 packages/react/src/oxygen-ui-react-auth-components/SignInImage/SignInImage.tsx create mode 100644 packages/react/src/oxygen-ui-react-auth-components/SignInImage/sign-in-image.scss diff --git a/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx b/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx index b1f98b33..5acacd50 100644 --- a/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx +++ b/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx @@ -23,6 +23,7 @@ import {WithWrapperProps} from '../models/component'; import SignInAlert from '../SignInAlert/SignInAlert'; import SignInButton, {SignInButtonProps} from '../SignInButton/SignInButton'; import SignInDivider from '../SignInDivider/SignInDivider'; +import SignInImage from '../SignInImage/SignInImage'; import SignInLink, {SignInLinkProps} from '../SignInLink/SignInLink'; import SignInPaper from '../SignInPaper/SignInPaper'; import SignInPinInput from '../SignInPinInput/SignInPinInput'; @@ -42,6 +43,7 @@ type SignInCompoundProps = { Alert: typeof SignInAlert; Button: typeof SignInButton; Divider: typeof SignInDivider; + Image: typeof SignInImage; Link: typeof SignInLink; Paper: typeof SignInPaper; PinInput: typeof SignInPinInput; @@ -115,5 +117,6 @@ SignIn.Link = SignInLink; SignIn.Button = SignInButton; SignIn.TextField = SignInTextField; SignIn.PinInput = SignInPinInput; +SignIn.Image = SignInImage; export default SignIn; diff --git a/packages/react/src/oxygen-ui-react-auth-components/SignInImage/SignInImage.tsx b/packages/react/src/oxygen-ui-react-auth-components/SignInImage/SignInImage.tsx new file mode 100644 index 00000000..117e0c27 --- /dev/null +++ b/packages/react/src/oxygen-ui-react-auth-components/SignInImage/SignInImage.tsx @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import clsx from 'clsx'; +import {ForwardRefExoticComponent, ImgHTMLAttributes, MutableRefObject, ReactElement, forwardRef} from 'react'; +import {WithWrapperProps} from '../models/component'; +import './sign-in-image.scss'; + +export type SignInImageProps = ImgHTMLAttributes; + +const COMPONENT_NAME: string = 'SignInImage'; + +const SignInImage: ForwardRefExoticComponent & WithWrapperProps = forwardRef( + (props: SignInImageProps, ref: MutableRefObject): ReactElement => { + const {className, alt, ...rest} = props; + + const classes: string = clsx(`Oxygen${COMPONENT_NAME}`, className); + + return {alt}; + }, +) as ForwardRefExoticComponent & WithWrapperProps; + +SignInImage.displayName = COMPONENT_NAME; +SignInImage.muiName = COMPONENT_NAME; + +export default SignInImage; diff --git a/packages/react/src/oxygen-ui-react-auth-components/SignInImage/sign-in-image.scss b/packages/react/src/oxygen-ui-react-auth-components/SignInImage/sign-in-image.scss new file mode 100644 index 00000000..49eda1de --- /dev/null +++ b/packages/react/src/oxygen-ui-react-auth-components/SignInImage/sign-in-image.scss @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +.OxygenSignInImage { + margin: 16px 0; + width: 65px; +} From fdc0c5d04ee37d7f1028038d39de23f7e685e3e6 Mon Sep 17 00:00:00 2001 From: Movin Silva Date: Sat, 11 May 2024 09:13:30 +0530 Subject: [PATCH 05/14] feat(auth-components): :lipstick: add styles for SignIn component --- .../SignIn/SignIn.tsx | 1 + .../SignIn/sign-in.scss | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 packages/react/src/oxygen-ui-react-auth-components/SignIn/sign-in.scss diff --git a/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx b/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx index 5acacd50..51211147 100644 --- a/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx +++ b/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx @@ -29,6 +29,7 @@ import SignInPaper from '../SignInPaper/SignInPaper'; import SignInPinInput from '../SignInPinInput/SignInPinInput'; import SignInTextField, {SignInTextFieldProps} from '../SignInTextField/SignInTextField'; import SignInTypography from '../SignInTypography/SignInTypography'; +import './sign-in.scss'; export type SignInProps = { component?: C; diff --git a/packages/react/src/oxygen-ui-react-auth-components/SignIn/sign-in.scss b/packages/react/src/oxygen-ui-react-auth-components/SignIn/sign-in.scss new file mode 100644 index 00000000..0db727a4 --- /dev/null +++ b/packages/react/src/oxygen-ui-react-auth-components/SignIn/sign-in.scss @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +.OxygenSignIn { + display: flex; + flex-flow: column nowrap; + align-content: center; + justify-content: center; + align-items: center; + text-align: left; + padding: 20px; +} From a3835bf04e4aead29a3ad79ea0fe40bd64feef27 Mon Sep 17 00:00:00 2001 From: Movin Silva Date: Sat, 11 May 2024 09:19:36 +0530 Subject: [PATCH 06/14] feat(auth-components): :sparkles: add prop support for logo in SignIn component --- .../src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx b/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx index 51211147..481a743b 100644 --- a/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx +++ b/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx @@ -35,6 +35,7 @@ export type SignInProps = { component?: C; links?: SignInLinkProps[]; loginOptions?: SignInButtonProps[]; + logo?: string; subtitle?: string; textFields?: SignInTextFieldProps[]; title?: string; @@ -74,13 +75,14 @@ const renderLoginOptions = (loginOptions: SignInButtonProps[]): ReactElement[] = const SignIn: ForwardRefExoticComponent & WithWrapperProps & SignInCompoundProps = forwardRef( (props: SignInProps, ref: MutableRefObject): ReactElement => { - const {className, title, subtitle, textFields, links, loginOptions, ...rest} = props; + const {className, title, subtitle, textFields, links, loginOptions, logo, ...rest} = props; const classes: string = clsx(`Oxygen${COMPONENT_NAME}`, className); - if (title || subtitle || textFields || links || loginOptions) { + if (title || subtitle || textFields || links || loginOptions || logo) { return ( + {logo && } {title && {title}} From 552bfc29ea044378babfa462350ab75bd771d69b Mon Sep 17 00:00:00 2001 From: Movin Silva Date: Sat, 11 May 2024 09:20:49 +0530 Subject: [PATCH 07/14] style(auth-components): :art: format signIn component --- .../react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx b/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx index 481a743b..7de88eb4 100644 --- a/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx +++ b/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx @@ -83,6 +83,7 @@ const SignIn: ForwardRefExoticComponent & WithWrapperProps & SignIn return ( {logo && } + {title && {title}} From 31f65c956b407f263acd04d5bad9807c364a4350 Mon Sep 17 00:00:00 2001 From: Movin Silva Date: Sat, 11 May 2024 13:44:52 +0530 Subject: [PATCH 08/14] feat(auth-components): :sparkles: add SignInFooter component --- .../SignIn/SignIn.tsx | 3 + .../SignInFooter/SignInFooter.tsx | 63 +++++++++++++++++++ .../SignInFooter/sign-in-footer.scss | 32 ++++++++++ 3 files changed, 98 insertions(+) create mode 100644 packages/react/src/oxygen-ui-react-auth-components/SignInFooter/SignInFooter.tsx create mode 100644 packages/react/src/oxygen-ui-react-auth-components/SignInFooter/sign-in-footer.scss diff --git a/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx b/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx index 7de88eb4..1dcc53a4 100644 --- a/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx +++ b/packages/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx @@ -23,6 +23,7 @@ import {WithWrapperProps} from '../models/component'; import SignInAlert from '../SignInAlert/SignInAlert'; import SignInButton, {SignInButtonProps} from '../SignInButton/SignInButton'; import SignInDivider from '../SignInDivider/SignInDivider'; +import SignInFooter from '../SignInFooter/SignInFooter'; import SignInImage from '../SignInImage/SignInImage'; import SignInLink, {SignInLinkProps} from '../SignInLink/SignInLink'; import SignInPaper from '../SignInPaper/SignInPaper'; @@ -45,6 +46,7 @@ type SignInCompoundProps = { Alert: typeof SignInAlert; Button: typeof SignInButton; Divider: typeof SignInDivider; + Footer: typeof SignInFooter; Image: typeof SignInImage; Link: typeof SignInLink; Paper: typeof SignInPaper; @@ -122,5 +124,6 @@ SignIn.Button = SignInButton; SignIn.TextField = SignInTextField; SignIn.PinInput = SignInPinInput; SignIn.Image = SignInImage; +SignIn.Footer = SignInFooter; export default SignIn; diff --git a/packages/react/src/oxygen-ui-react-auth-components/SignInFooter/SignInFooter.tsx b/packages/react/src/oxygen-ui-react-auth-components/SignInFooter/SignInFooter.tsx new file mode 100644 index 00000000..0cab886a --- /dev/null +++ b/packages/react/src/oxygen-ui-react-auth-components/SignInFooter/SignInFooter.tsx @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import {Grid, GridProps} from '@oxygen-ui/react'; +import clsx from 'clsx'; +import {ElementType, ForwardRefExoticComponent, MutableRefObject, ReactElement, forwardRef} from 'react'; +import {WithWrapperProps} from '../models/component'; +import SignInLink from '../SignInLink/SignInLink'; +import SignInTypography from '../SignInTypography/SignInTypography'; +import './sign-in-footer.scss'; + +const COMPONENT_NAME: string = 'SignInFooter'; + +export type SignInFooterProps = { + component?: C; +} & Omit; + +// TODO: Handling props for the component +const SignInFooter: ForwardRefExoticComponent & WithWrapperProps = forwardRef( + (props: SignInFooterProps, ref: MutableRefObject): ReactElement => { + const year: number = new Date().getFullYear(); + + const {className, ...rest} = props; + + const classes: string = clsx(`Oxygen${COMPONENT_NAME}`, className); + + return ( + + + © {year} WSO2 LLC. + + + + Terms of Use + + + Privacy Policy + + + en-US + + + + ); + }, +) as ForwardRefExoticComponent & WithWrapperProps; + +export default SignInFooter; diff --git a/packages/react/src/oxygen-ui-react-auth-components/SignInFooter/sign-in-footer.scss b/packages/react/src/oxygen-ui-react-auth-components/SignInFooter/sign-in-footer.scss new file mode 100644 index 00000000..6c19aa9b --- /dev/null +++ b/packages/react/src/oxygen-ui-react-auth-components/SignInFooter/sign-in-footer.scss @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +.OxygenSignInFooter { + width: 100%; + margin: 16px 0; + color: grey; + + .OxygenSignInLink { + color: grey; + + &:hover { + color: #ff7300; + cursor: pointer; + } + } +} From ddcc908f8167daf1b2df68ee361f7c98a98a4357 Mon Sep 17 00:00:00 2001 From: Movin Silva Date: Sat, 11 May 2024 13:47:54 +0530 Subject: [PATCH 09/14] refactor(auth-components): :recycle: change naming style of class names in SignInButton --- .../SignInButton/SignInButton.tsx | 2 +- .../SignInButton/sign-in-button.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react/src/oxygen-ui-react-auth-components/SignInButton/SignInButton.tsx b/packages/react/src/oxygen-ui-react-auth-components/SignInButton/SignInButton.tsx index acfe8b4a..51a8fb98 100644 --- a/packages/react/src/oxygen-ui-react-auth-components/SignInButton/SignInButton.tsx +++ b/packages/react/src/oxygen-ui-react-auth-components/SignInButton/SignInButton.tsx @@ -35,7 +35,7 @@ const SignInButton: ForwardRefExoticComponent & WithWrapperPr let classes: string = clsx(`Oxygen${COMPONENT_NAME}`, className); if (social) { - classes = clsx(classes, `Oxygen${COMPONENT_NAME}Social`); + classes = clsx(classes, `Oxygen${COMPONENT_NAME}-social`); } return