This repository was archived by the owner on May 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
#433: Add EbayFilePreviewCard #475
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
93bd435
add ebay preview card component
brunokernd a19b8b4
add changeset
brunokernd 2cff42b
Merge remote-tracking branch 'origin/main' into preview-card
brunokernd 74d8178
add component to library readme
brunokernd 78457be
update tests
brunokernd 53d96ca
fix types issues
brunokernd 736a1b2
improve documentation
brunokernd 476aa0e
fix components rendering logic
brunokernd 7b48961
update storybook
brunokernd a584642
Merge remote-tracking branch 'origin/main' into preview-card
brunokernd 6156cd9
export default meta storybook
brunokernd 542dc18
refactor component to have different componens
brunokernd 41ea3e3
handle menu select on preview action component
brunokernd 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 hidden or 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,5 @@ | ||
--- | ||
'@ebay/ui-core-react': minor | ||
--- | ||
|
||
feat: add new EbayFilePreviewCard component |
This file contains hidden or 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 hidden or 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,69 @@ | ||
# EbayFilePreviewCard | ||
|
||
## Demo | ||
|
||
[Storybook](https://opensource.ebay.com/ebayui-core-react/main/?path=/docs/media-ebay-file-preview-card--docs) | ||
|
||
## Usage | ||
|
||
### Import JS | ||
|
||
```jsx harmony | ||
import { EbayFilePreviewCard } from '@ebay/ui-core-react/ebay-file-preview-card' | ||
``` | ||
|
||
### Import following styles from SKIN | ||
|
||
```jsx harmony | ||
import '@ebay/skin/file-preview-card' | ||
``` | ||
|
||
### Or import styles using SCSS/CSS | ||
|
||
```jsx harmony | ||
import '@ebay/skin/file-preview-card.css' | ||
``` | ||
|
||
### Import icons | ||
|
||
Add the below icons to the `EbaySvg` component. | ||
|
||
Note: Make sure that `EbaySvg` is only rendered on the server so it does not affect the client bundle size. | ||
|
||
```tsx | ||
<EbaySvg icons={['close16', 'delete16', 'vertical16', 'play16', 'file24']} /> | ||
``` | ||
|
||
```jsx harmony | ||
<EbayFilePreviewCard | ||
status="uploading" | ||
a11yCancelUploadText="Cancel Uploard" | ||
onCancel={(e) => action('onCancel')(e)} | ||
/> | ||
``` | ||
|
||
## Attributes | ||
HenriqueLimas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
| Name | Type | Required | Description | Data | | ||
| ---------------------- | ------------------------------------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------ | ---- | | ||
| `a11yCancelUploadText` | `String` | No | a11y text for cancel upload button. | | | ||
| `as` | `React.ElementType` | No | Element type for the preview card, default is `div` | | | ||
| `deleteText` | `String` | No | Text for delete button. | | | ||
| `status` | `String` | No | Status of the file, can be `"uploading"` | | | ||
| `labelText` | `String` | No | Text to display in the label. | | | ||
| `footerTitle` | `String` | No | Title to display beneath the file, usually the filename. | | | ||
| `footerSubtitle` | `String` | No | Subtitle to display beneath the file title. | | | ||
| `infoText` | `String` | No | Text to display info in file if not image. | | | ||
| `file` | `File` or `{name: string, type?: File[type], src?: string }` | No | File object, can be raw platform `File` or an object containing `name`, `type`, and a `src` for the preview. | | | ||
| `menuActions` | `{event: string, label: string }[]` | No | Array of menu actions, containing event and label. | | | ||
| `seeMore` | `Number` | No | Passing a number here will convert the card to a "see more" card. | | | ||
| `a11ySeeMoreText` | `String` | No | a11y text for see more button. | | ||
|
||
## Events | ||
|
||
| Name | Type | Required | Description | Data | | ||
| -------------- | ---------------------------- | -------- | --------------------------------------------------- | --------------------------------------------------------------- | | ||
| `onMenuAction` | `EbayMenuSelectEventHandler` | No | Triggered when an action is selected from the menu. | `event, {index: number, checked: number[], eventName?: string}` | | ||
| `onSeeMore` | `EbayEventHandler` | No | Triggered when the see more button is clicked. | `event` | | ||
| `onDelete` | `EbayEventHandler` | No | Triggered when the delete button is clicked. | `event` | | ||
| `onCancel` | `EbayEventHandler` | No | Triggered when the cancel button is clicked. | `event` | |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.