-
Notifications
You must be signed in to change notification settings - Fork 271
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
chore(ui5-media-gallery): migrate to jsx template #10614
Open
kineticjs
wants to merge
11
commits into
SAP:main
Choose a base branch
from
kineticjs:media-gallery-jsx-template
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+83
−75
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
baffe2f
chore(ui5-media-gallery): migrate to jsx template
kineticjs bab14bc
chore(ui5-media-gallery): migrate to jsx template
kineticjs 613a1cb
chore(ui5-media-gallery): migrate to jsx template
kineticjs f46ad1a
chore(ui5-media-gallery): migrate to jsx template
kineticjs 7cc5e60
chore(ui5-media-gallery): migrate to jsx template
kineticjs 44b2153
chore(ui5-media-gallery): migrate to jsx template
kineticjs 480a2a1
chore(ui5-media-gallery): migrate to jsx template
kineticjs 849f195
Merge remote-tracking branch 'origin/main' into media-gallery-jsx-tem…
kineticjs c8dcbb3
chore(ui5-media-gallery): migrate to jsx template
kineticjs 02aeabf
chore(ui5-media-gallery): formatting corrected
kineticjs ea90125
chore(ui5-media-gallery): formatting corrected
kineticjs 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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type MediaGalleryItem from "./MediaGalleryItem.js"; | ||
import Icon from "@ui5/webcomponents/dist/Icon.js"; | ||
|
||
export default function MediaGalleryItemTemplate(this: MediaGalleryItem) { | ||
return ( | ||
<div class="ui5-media-gallery-item-root" | ||
tabindex={this.effectiveTabIndex} | ||
data-sap-focus-ref | ||
onKeyDown={this._onkeydown} | ||
onKeyUp={this._onkeyup} | ||
role={this._role} | ||
> | ||
<div class="ui5-media-gallery-item-mask-layer"></div> | ||
<div class="ui5-media-gallery-item-wrapper" style={this.styles.wrapper}> | ||
{this._showBackgroundIcon && <Icon name="background"></Icon>} | ||
{this._useContent && <slot />} | ||
{this._useThumbnail && <slot name="thumbnail" />} | ||
</div> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import type MediaGallery from "./MediaGallery.js"; | ||
import MediaGalleryItem from "./MediaGalleryItem.js"; | ||
import Carousel from "@ui5/webcomponents/dist/Carousel.js"; | ||
import Button from "@ui5/webcomponents/dist/Button.js"; | ||
|
||
export default function MediaGalleryTemplate(this: MediaGallery) { | ||
return ( | ||
<div class="ui5-media-gallery-root"> | ||
<div class="ui5-media-gallery-display-wrapper"> | ||
<div class="ui5-media-gallery-display" | ||
onClick={this._onDisplayAreaClick}> | ||
{this._isPhonePlatform | ||
? <Carousel | ||
onNavigate={this._onCarouselNavigate} | ||
hideNavigationArrows | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. really minor - explicitly setting to true is recommended => |
||
> | ||
{this._selectableItems.map(item => | ||
<slot name={item._individualSlot}></slot> | ||
)} | ||
</Carousel> | ||
: <MediaGalleryItem | ||
_interactive={this.interactiveDisplayArea} | ||
_square={this._shouldHaveSquareDisplay} | ||
tabIndex={this._mainItemTabIndex} | ||
></MediaGalleryItem> | ||
} | ||
</div> | ||
</div> | ||
|
||
{this._showThumbnails && <div class="ui5-media-gallery-thumbnails-wrapper"> | ||
<ul> | ||
{this._visibleItems.map(item => | ||
<li id={item.id} | ||
class="ui5-media-gallery-thumbnail" | ||
role="option" | ||
onClick={this._onThumbnailClick} | ||
> | ||
<slot name={item._individualSlot}></slot> | ||
</li> | ||
)} | ||
{this._showOverflowBtn && <li class="ui5-media-gallery-overflow"> | ||
<Button onClick={this._onOverflowBtnClick}> | ||
+{this._overflowSize} | ||
</Button> | ||
</li>} | ||
</ul> | ||
</div>} | ||
</div> | ||
); | ||
} |
Oops, something went wrong.
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.
One new thing around the migration is that we also encourage importing the used icons in the template
and make use of its default export to bind it:
This way we will avoid icons missed to be imported, because using the hardcoded string does not have relation to the import.
*afterwards, you can remove the import from the MGitem class