-
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.
* Add RSVP page * Improve validation and add discord username help image * Fix timezone format * Add finish screen * Fix initial textarea height
- Loading branch information
1 parent
063f430
commit 57a593d
Showing
22 changed files
with
544 additions
and
28 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,15 @@ | ||
import React from 'react'; | ||
|
||
type PropTypes = { | ||
color?: string; | ||
[key: string]: unknown; | ||
}; | ||
|
||
const HelpIcon = ({ color, ...props }: PropTypes): JSX.Element => ( | ||
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" {...props}> | ||
<path d="M0 0h24v24H0z" fill="none" /> | ||
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z" fill={color} /> | ||
</svg> | ||
); | ||
|
||
export default HelpIcon; |
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,15 +1,42 @@ | ||
import clsx from 'clsx'; | ||
import React, { forwardRef } from 'react'; | ||
import clsx from 'clsx'; | ||
|
||
import styles from './styles.module.scss'; | ||
|
||
type PropTypes = { | ||
className?: string; | ||
multiline?: boolean; | ||
[key: string]: unknown; | ||
}; | ||
|
||
const StyledInput = forwardRef<HTMLInputElement, PropTypes>(({ className, ...props }: PropTypes, ref): JSX.Element => ( | ||
<input className={clsx(styles.input, className)} {...props} ref={ref} /> | ||
)); | ||
// Adapted from https://stackoverflow.com/a/46777664 | ||
const adjustHeight = (textarea: HTMLTextAreaElement|null) => { | ||
if (textarea) { | ||
textarea.style.height = ''; | ||
textarea.style.height = `${textarea.scrollHeight}px`; | ||
} | ||
}; | ||
|
||
const StyledInput = forwardRef<HTMLInputElement|HTMLTextAreaElement, PropTypes>(({ className, multiline = false, ...props }: PropTypes, ref): JSX.Element => { | ||
if (multiline) { | ||
return ( | ||
<textarea | ||
className={clsx(styles.input, styles.multiline, className)} | ||
{...props} | ||
onChange={({ target }) => adjustHeight(target)} | ||
ref={(r) => { | ||
if (typeof ref === 'function') { | ||
ref(r); | ||
} else if (ref) { | ||
ref.current = r; | ||
} | ||
adjustHeight(r); // set initial height when the texarea is loaded | ||
}} | ||
/> | ||
); | ||
} | ||
|
||
return <input className={clsx(styles.input, className)} {...props} ref={ref as React.Ref<HTMLInputElement>} />; | ||
}); | ||
|
||
export default StyledInput; |
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 |
---|---|---|
|
@@ -15,4 +15,8 @@ | |
color: #525051; | ||
font-size: 0.9em; | ||
} | ||
|
||
&.multiline { | ||
font-size: 1.1em; | ||
} | ||
} |
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,9 @@ | ||
.inputContainer { | ||
display: flex; | ||
|
||
.helpLink { | ||
align-self: flex-end; | ||
margin-left: 5px; | ||
color: #3C519C; | ||
} | ||
} |
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,45 @@ | ||
import { useEffect } from 'react'; | ||
import { useController, useFormContext } from 'react-hook-form'; | ||
import seedrandom from 'seedrandom'; | ||
|
||
type WithOptionList = { options: unknown[] }; | ||
type WithFunctionGenerator = { | ||
min: number, // inclusive | ||
max: number, // exclusive | ||
generateValue: (num: number) => unknown | ||
}; | ||
type ValueChoices = WithOptionList | WithFunctionGenerator; | ||
type PropTypes = { name: string, seed?: string } & ValueChoices; | ||
|
||
function areOptionsSpecified(props: ValueChoices): props is WithOptionList { | ||
return (props as WithOptionList).options !== undefined; | ||
} | ||
|
||
const Random = ({ name, seed, ...props }: PropTypes): JSX.Element|null => { | ||
const { control } = useFormContext(); | ||
const { field } = useController({ name, control, defaultValue: null }); | ||
|
||
useEffect(() => { | ||
const random = () => { | ||
if (seed) { | ||
const rng = seedrandom(seed); | ||
return rng(); | ||
} | ||
return Math.random(); | ||
}; | ||
|
||
if (areOptionsSpecified(props)) { | ||
const { options } = props; | ||
const index = Math.floor(random() * options.length); | ||
field.onChange(options[index]); | ||
} else { | ||
const { min, max, generateValue } = props; | ||
const num = Math.floor(random() * (max - min)) + min; | ||
field.onChange(generateValue(num)); | ||
} | ||
}, [field, props, seed]); | ||
|
||
return null; | ||
}; | ||
|
||
export default Random; |
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,15 @@ | ||
import React from 'react'; | ||
|
||
import MOUNTAINS from 'assets/registration/mountains.svg'; | ||
import STARS from 'assets/registration/stars.svg'; | ||
import styles from './styles.module.scss'; | ||
|
||
const Background: React.FC = () => ( | ||
<div className={styles.background}> | ||
<div className={styles.stars} style={{ backgroundImage: `url("${STARS}")` }} /> | ||
<img src={MOUNTAINS} className={styles.mountains} alt="" /> | ||
<div className={styles.road} /> | ||
</div> | ||
); | ||
|
||
export default Background; |
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,40 @@ | ||
.background { | ||
background: linear-gradient(180deg, #2A3170 19.44%, #2B6776 59.7%); | ||
width: 100vw; | ||
height: 100%; | ||
position: absolute; | ||
overflow: hidden; | ||
|
||
.stars { | ||
width: 100%; | ||
height: calc(100% - 28vw); // ensure that the stars don't overlap with the translucent mountains | ||
max-height: 425px; | ||
background-position: center top; | ||
background-size: 1500px; | ||
} | ||
|
||
.mountains { | ||
position: absolute; | ||
bottom: 0; | ||
width: 115%; | ||
left: 53%; | ||
transform: translateX(-50%); | ||
|
||
@media (min-width: 2000px) { | ||
width: 100%; | ||
left: 50%; | ||
} | ||
} | ||
|
||
.road { | ||
position: absolute; | ||
bottom: 0; | ||
width: 100%; | ||
height: 6vw; | ||
background-color: #282939; | ||
|
||
@media (min-width: 2000px) { | ||
height: 5.5vw; | ||
} | ||
} | ||
} |
Oops, something went wrong.