tycho-components 0.2.4-SNAPSHOT-8 → 0.2.5-SNAPSHOT

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,8 @@ type PictureProps = {
3
3
  src: string;
4
4
  title?: string;
5
5
  className?: string;
6
+ person?: boolean;
6
7
  onClick?: () => void;
7
8
  };
8
- export default function AppPicture({ src, title, className, onClick, }: PictureProps): import("react/jsx-runtime").JSX.Element;
9
+ export default function AppPicture({ src, title, className, person, onClick, }: PictureProps): import("react/jsx-runtime").JSX.Element;
9
10
  export {};
@@ -2,16 +2,16 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from 'react';
3
3
  import ImageUtils from '../functions/ImageUtils';
4
4
  import './style.scss';
5
- export default function AppPicture({ src, title, className, onClick, }) {
5
+ export default function AppPicture({ src, title, className, person, onClick, }) {
6
6
  const [empty, setEmpty] = useState(false);
7
7
  useEffect(() => {
8
8
  setEmpty(!src);
9
9
  }, []);
10
- return (_jsx("div", { className: `app-picture-container ${empty ? 'empty' : ''}`, children: _jsx("img", { className: `${className} ${src ? '' : 'picture-placeholder'}`, src: ImageUtils.display(src), title: title, onClick: () => onClick && onClick(), onError: ({ currentTarget }) => {
10
+ return (_jsx("div", { className: `app-picture-container ${empty ? 'empty' : ''}`, children: _jsx("img", { className: `${className} ${src ? '' : 'picture-placeholder'}`, src: ImageUtils.display(src, person), title: title, onClick: () => onClick && onClick(), onError: ({ currentTarget }) => {
11
11
  setEmpty(true);
12
12
  /* eslint-disable no-param-reassign */
13
13
  currentTarget.onerror = null; // prevents looping
14
- currentTarget.src = ImageUtils.getPlaceHolder();
14
+ currentTarget.src = ImageUtils.getPlaceHolder(person);
15
15
  /* eslint-enable no-param-reassign */
16
16
  } }) }));
17
17
  }
@@ -1,5 +1,5 @@
1
1
  declare const ImageUtils: {
2
- display: (url: string) => string;
3
- getPlaceHolder: () => string;
2
+ display: (url: string, person?: boolean) => string;
3
+ getPlaceHolder: (person?: boolean) => string;
4
4
  };
5
5
  export default ImageUtils;
@@ -1,10 +1,11 @@
1
1
  import placeholder from './placeholder-image.png';
2
- const display = (url) => {
2
+ import placeholderPerson from './placeholder-person.png';
3
+ const display = (url, person) => {
3
4
  if (url && url !== '')
4
5
  return url;
5
- return placeholder;
6
+ return person ? placeholderPerson : placeholder;
6
7
  };
7
- const getPlaceHolder = () => placeholder;
8
+ const getPlaceHolder = (person) => person ? placeholderPerson : placeholder;
8
9
  const ImageUtils = {
9
10
  display,
10
11
  getPlaceHolder,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tycho-components",
3
3
  "private": false,
4
- "version": "0.2.4-SNAPSHOT-8",
4
+ "version": "0.2.5-SNAPSHOT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {