cleanup view-document styling in jsx

This commit is contained in:
Max Leiter 2022-12-18 13:46:52 -08:00
parent 23a850253b
commit f07f4789ee
2 changed files with 8 additions and 9 deletions

View file

@ -63,7 +63,7 @@ const Document = ({ skeleton, ...props }: Props) => {
return ( return (
<> <>
<div className={styles.card}> <div className={styles.card}>
<div className={styles.fileNameContainer}> <div>
<Skeleton width={"100%"} height={36} /> <Skeleton width={"100%"} height={36} />
</div> </div>
<div className={styles.documentContainer}> <div className={styles.documentContainer}>

View file

@ -20,10 +20,8 @@ export const config = (env: Environment): Config => {
return true return true
} else if (str === "false" || str === "0") { } else if (str === "false" || str === "0") {
return false return false
} else if (str) {
throw new Error(`Invalid boolean value: ${str}`)
} else { } else {
return false return Boolean(str)
} }
} }
@ -59,8 +57,11 @@ export const config = (env: Environment): Config => {
const is_production = env.NODE_ENV === "production" const is_production = env.NODE_ENV === "production"
const developmentDefault = (name: string, defaultValue: string): string => { const developmentDefault = (name: string, defaultValue: string): string => {
if (is_production) return throwIfUndefined(name) if (is_production) {
return defaultIfUndefined(name, defaultValue) return throwIfUndefined(name)
} else {
return defaultIfUndefined(name, defaultValue)
}
} }
validNodeEnvs(env.NODE_ENV) validNodeEnvs(env.NODE_ENV)
@ -77,9 +78,7 @@ export const config = (env: Environment): Config => {
github_client_id: env.GITHUB_CLIENT_ID ?? "", github_client_id: env.GITHUB_CLIENT_ID ?? "",
github_client_secret: env.GITHUB_CLIENT_SECRET ?? "", github_client_secret: env.GITHUB_CLIENT_SECRET ?? "",
nextauth_secret: throwIfUndefined("NEXTAUTH_SECRET"), nextauth_secret: throwIfUndefined("NEXTAUTH_SECRET"),
credential_auth: stringToBoolean( credential_auth: stringToBoolean("CREDENTIAL_AUTH")
developmentDefault("CREDENTIAL_AUTH", "true")
)
} }
return config return config
} }