Skip to content

Commit

Permalink
Merge pull request #382 from AllenInstitute/bugfix/svgicon-build-size
Browse files Browse the repository at this point in the history
bugfix/svgicon-build-size
  • Loading branch information
BrianWhitneyAI authored Jan 7, 2025
2 parents 719933e + e893bf0 commit 1ad9c7c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
4 changes: 2 additions & 2 deletions packages/core/components/FileThumbnail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ export default function FileThumbnail(props: Props) {
if (!props.uri) {
return (
<SvgIcon
height={props.height}
height={props?.height || 150}
pathData={NO_IMAGE_ICON_PATH_DATA}
viewBox="0,1,22,22"
width={props.width}
width={props?.width || 150}
className={classNames(styles.noThumbnail, {
[styles.noThumbnailSelected]: props?.selected,
})}
Expand Down
16 changes: 3 additions & 13 deletions packages/core/components/SvgIcon/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import classNames from "classnames";
import { castArray, defaults } from "lodash";
import { castArray } from "lodash";
import * as React from "react";

import styles from "./SvgIcon.module.css";
Expand All @@ -13,22 +13,12 @@ interface SvgIconProps {
width?: number | string;
viewBox: string;
}

// forwardRef components cannot make use of React's defaultProps mechanism
const DEFAULT_PROPS = {
height: 15,
pathAttrs: {},
width: 15,
};

/**
* A generalized SVG icon.
*/
function SvgIcon(props: SvgIconProps, ref?: React.Ref<SVGSVGElement>) {
const { className, height, onClick, pathAttrs, pathData, viewBox, width } = defaults(
props,
DEFAULT_PROPS
);
const { className, height, onClick, pathAttrs = {}, pathData, viewBox, width } = props;

return (
<svg
className={classNames({ [styles.interactive]: onClick !== undefined }, className)}
Expand Down

0 comments on commit 1ad9c7c

Please sign in to comment.