-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #155 from IFRCGo/feature/login-page
Add login page
- Loading branch information
Showing
34 changed files
with
1,359 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { defineConfig, Schema } from '@julr/vite-plugin-validate-env'; | ||
|
||
// TODO: Integrate .env for CI and remove optional() call on required fields | ||
export default defineConfig({ | ||
APP_TITLE: Schema.string.optional(), | ||
APP_MAPBOX_ACCESS_TOKEN: Schema.string(), | ||
APP_GRAPHQL_ENDPOINT: Schema.string.optional(), | ||
APP_GOOGLE_ANALYTICS_ID: Schema.string.optional(), | ||
}) | ||
APP_HCAPTCHA_SITEKEY: Schema.string.optional(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import React, { useCallback } from 'react'; | ||
import HCaptcha from '@hcaptcha/react-hcaptcha'; | ||
import { | ||
InputContainer, | ||
InputContainerProps, | ||
} from '@ifrc-go/ui'; | ||
|
||
import { hCaptchaKey } from '#config'; | ||
|
||
export type HCaptchaProps<T> = Omit<InputContainerProps, 'input'> & { | ||
name: T, | ||
onChange: (value: string | undefined, name: T) => void; | ||
elementRef?: React.RefObject<HCaptcha>; | ||
}; | ||
|
||
function HCaptchaInput<T extends string>(props: HCaptchaProps<T>) { | ||
const { | ||
actions, | ||
actionsContainerClassName, | ||
className, | ||
disabled, | ||
error, | ||
errorContainerClassName, | ||
hint, | ||
hintContainerClassName, | ||
icons, | ||
iconsContainerClassName, | ||
inputSectionClassName, | ||
label, | ||
readOnly, | ||
name, | ||
onChange, | ||
elementRef, | ||
} = props; | ||
|
||
const handleVerify = useCallback( | ||
(token: string) => { | ||
onChange(token, name); | ||
}, | ||
[onChange, name], | ||
); | ||
const handleError = useCallback( | ||
(err: string) => { | ||
// eslint-disable-next-line no-console | ||
console.error(err); | ||
onChange(undefined, name); | ||
}, | ||
[onChange, name], | ||
); | ||
const handleExpire = useCallback( | ||
() => { | ||
onChange(undefined, name); | ||
}, | ||
[onChange, name], | ||
); | ||
|
||
return ( | ||
<InputContainer | ||
actions={actions} | ||
actionsContainerClassName={actionsContainerClassName} | ||
className={className} | ||
disabled={disabled} | ||
error={error} | ||
errorContainerClassName={errorContainerClassName} | ||
hint={hint} | ||
hintContainerClassName={hintContainerClassName} | ||
icons={icons} | ||
iconsContainerClassName={iconsContainerClassName} | ||
inputSectionClassName={inputSectionClassName} | ||
label={label} | ||
readOnly={readOnly} | ||
input={hCaptchaKey && ( | ||
<HCaptcha | ||
ref={elementRef} | ||
sitekey={hCaptchaKey} | ||
onVerify={handleVerify} | ||
onError={handleError} | ||
onExpire={handleExpire} | ||
/> | ||
)} | ||
/> | ||
); | ||
} | ||
|
||
export default HCaptchaInput; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,6 @@ | |
} | ||
|
||
.menu-item:hover { | ||
text-decoration: underline; | ||
color: var(--go-ui-color-primary-red); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.