Skip to content

Commit

Permalink
Refactor styles and improve preview URL handling in Upload and Image …
Browse files Browse the repository at this point in the history
…components
  • Loading branch information
trheyi committed Nov 1, 2024
1 parent 3baccda commit df1d396
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 1 addition & 3 deletions packages/xgen/components/edit/Upload/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@
width: auto;
color: var(--color_title);
background: var(--color_bg_nav);
border-top-left-radius: 6px;
border-bottom-right-radius: 6px;
border-bottom-left-radius: 6px;
border-radius: 6px;
z-index: 99;
filter: drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,16 @@ export function GetData(xhr: XMLHttpRequest, customPreviewURL: boolean = false):

export function GetPreviewURL(params: PreviewParams): string {
const { response, token, useAppRoot } = params
let { previewURL } = params
let { previewURL } = params || {}

// Validate response
if (response.path && typeof response.path !== 'string') {
return ''
}

// Http Request
if (!previewURL && response.path?.startsWith('http')) {
return response.path
return response.path || ''
}

// Default preview URL
Expand Down
1 change: 0 additions & 1 deletion packages/xgen/components/view/Image/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
box-sizing: border-box;
border: 1px solid var(--color_border);
border-radius: 6px;

object-fit: cover;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/xgen/components/view/Image/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Index = (props: IProps) => {
const values = Array.isArray(__value) ? __value : [__value]
values.forEach((item) => {
const url = GetPreviewURL({
response: { path: item },
response: { path: item || '' },
previewURL,
useAppRoot,
token,
Expand Down
4 changes: 1 addition & 3 deletions packages/xgen/public/components/edit/Upload/chunk.1.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@
width: auto;
color: var(--color_title);
background: var(--color_bg_nav);
border-top-left-radius: 6px;
border-bottom-right-radius: 6px;
border-bottom-left-radius: 6px;
border-radius: 6px;
z-index: 99;
filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.07)) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.06));
}
Expand Down

0 comments on commit df1d396

Please sign in to comment.