-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Component center img #143
Merged
Merged
Component center img #143
Changes from 21 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
682bd19
refactor: add new component for image centering, change <img /> throu…
YUUU23 4c9d413
add: add into documentation on center_img.jsx on how to add in multip…
YUUU23 ab1e697
refactor: add new component for image centering, change <img /> throu…
YUUU23 d8610c2
add: add into documentation on center_img.jsx on how to add in multip…
YUUU23 805f4f2
rebase on main
YUUU23 5c826fb
Merge branch 'component-center-img' of https://github.com/brown-ccv/h…
YUUU23 2073dbe
refactor: add new component for image centering, change <img /> throu…
YUUU23 efb389a
add: add into documentation on center_img.jsx on how to add in multip…
YUUU23 e464c2d
Merge branch 'component-center-img' of https://github.com/brown-ccv/h…
YUUU23 9f24607
refactor: add new component for image centering, change <img /> throu…
YUUU23 4e7584c
add: add into documentation on center_img.jsx on how to add in multip…
YUUU23 87bd2aa
Merge branch 'component-center-img' of https://github.com/brown-ccv/h…
YUUU23 040fb9d
center_img
YUUU23 68f7be4
add: add into documentation on center_img.jsx on how to add in multip…
YUUU23 261b175
Merge branch 'component-center-img' of https://github.com/brown-ccv/h…
YUUU23 0fa61fe
Delete .firebaserc 2
YUUU23 e8a5908
Delete firebase 2.json
YUUU23 3639294
merge with main
YUUU23 aa91bf4
refactor: change semantics on component name and remove extra space
YUUU23 27b91da
refactor: use props delegation instead of simply props
YUUU23 8b899d3
refactor: use props delegation for img style
YUUU23 2ceddef
refactor: change to delegated, taking in image style directly
YUUU23 834e37b
refactor: CenteredImage component to its own component folder, correc…
YUUU23 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from "react"; | ||
|
||
/** | ||
* Component for centering an image in the docs | ||
* | ||
* @param {*} props : | ||
* src: image source | ||
* alt: image alternative text | ||
* 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({ src, alt, ...delegated }) { | ||
let imgStyleString; | ||
if ( | ||
delegated.imgStyle != undefined && | ||
Object.keys(delegated.imgStyle).length === 0 | ||
) { | ||
imgStyleString = {}; | ||
} else { | ||
imgStyleString = delegated.imgStyle; | ||
} | ||
|
||
return ( | ||
<div style={{ textAlign: "center" }}> | ||
<img src={src} alt={alt} style={imgStyleString} /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you destructure the delegated prop object into the image it will handle all of the style props for you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means you can delete lines 13-21