Skip to content

Commit

Permalink
refactor: use props delegation instead of simply props
Browse files Browse the repository at this point in the history
  • Loading branch information
YUUU23 committed Jul 9, 2024
1 parent aa91bf4 commit 27b91da
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/assets/CenteredImage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ import React from "react";
* imgStyle: object, any image styles (props can be passed in as: `imgStyle={{ maxHeight: "600px", border: "solid" }}`)
* @returns a component for uniformally centering images in the doc
*/
export default function CenteredImage(props) {
export default function CenteredImage({ src, alt, imgStyle }) {
let imgStyleString;
if (props.imgStyle != undefined && Object.keys(props.imgStyle).length === 0) {
if (imgStyle != undefined && Object.keys(imgStyle).length === 0) {
imgStyleString = {};
} else {
imgStyleString = props.imgStyle;
imgStyleString = imgStyle;
}

return (
<div style={{ textAlign: "center" }}>
<img src={props.src} alt={props.alt} style={imgStyleString} />
<img src={src} alt={alt} style={imgStyleString} />
</div>
);
}

0 comments on commit 27b91da

Please sign in to comment.