mirror of
https://github.com/techno-tim/littlelink-server.git
synced 2024-11-22 05:25:13 +01:00
AVATAR_SIZE environment variable (#509)
* Add and configure AVATAR_SIZE environment variable * updated pr * update snapshot --------- Co-authored-by: Techno Tim <timothystewart6@gmail.com>
This commit is contained in:
parent
96d3680397
commit
41654b9325
@ -20,6 +20,7 @@ exports[`<App /> <App /> snapshot 1`] = `
|
||||
>
|
||||
<img
|
||||
className="avatar"
|
||||
style={Object {}}
|
||||
/>
|
||||
<h1>
|
||||
undefined
|
||||
|
@ -1,11 +1,13 @@
|
||||
import React, { memo } from 'react';
|
||||
import { string } from 'prop-types';
|
||||
import { addShadow } from '../../utils';
|
||||
import { runtimeConfig } from '../../config';
|
||||
|
||||
import './Avatar.css';
|
||||
|
||||
function Avatar(props) {
|
||||
const { src, srcSet, alt } = props;
|
||||
const avatarSize = runtimeConfig.AVATAR_SIZE || null;
|
||||
|
||||
return (
|
||||
<img
|
||||
@ -13,6 +15,7 @@ function Avatar(props) {
|
||||
src={src}
|
||||
srcSet={srcSet}
|
||||
alt={alt}
|
||||
style={avatarSize ? { width: avatarSize, height: avatarSize } : {}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -3,5 +3,6 @@
|
||||
exports[`<Avatar /> <Avatar /> snapshot 1`] = `
|
||||
<img
|
||||
className="avatar"
|
||||
style={Object {}}
|
||||
/>
|
||||
`;
|
||||
|
@ -17,6 +17,7 @@ exports[`<Home /> <Home /> snapshot 1`] = `
|
||||
>
|
||||
<img
|
||||
className="avatar"
|
||||
style={Object {}}
|
||||
/>
|
||||
<h1>
|
||||
undefined
|
||||
|
@ -16,6 +16,7 @@ export const runtimeConfig =
|
||||
THEME: window?.env?.THEME,
|
||||
FAVICON_URL: window?.env?.FAVICON_URL,
|
||||
AVATAR_URL: window?.env?.AVATAR_URL,
|
||||
AVATAR_SIZE: window?.env?.AVATAR_SIZE,
|
||||
AVATAR_ALT: window?.env?.AVATAR_ALT,
|
||||
AVATAR_2X_URL: window?.env?.AVATAR_2X_URL,
|
||||
NAME: window?.env?.NAME,
|
||||
@ -183,6 +184,9 @@ export const runtimeConfig =
|
||||
AVATAR_URL: nodeIsProduction
|
||||
? process.env.AVATAR_URL
|
||||
: process.env.RAZZLE_AVATAR_URL,
|
||||
AVATAR_SIZE: nodeIsProduction
|
||||
? process.env.AVATAR_SIZE
|
||||
: process.env.RAZZLE_AVATAR_SIZE,
|
||||
AVATAR_ALT: nodeIsProduction
|
||||
? process.env.AVATAR_ALT
|
||||
: process.env.RAZZLE_AVATAR_ALT,
|
||||
|
Loading…
Reference in New Issue
Block a user