Skip to content

Commit

Permalink
fix(icon-view): fixed CDNIcon size (#890)
Browse files Browse the repository at this point in the history
  • Loading branch information
v-gevak authored Oct 10, 2023
1 parent 13e92eb commit f83ccb5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changeset/spotty-jokes-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@alfalab/core-components-cdn-icon': patch
'@alfalab/core-components-icon-view': patch
---

CDNIcon теперь занимает всю ширину и высоту IconView
6 changes: 4 additions & 2 deletions packages/cdn-icon/src/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ export const CDNIcon: React.FC<CDNIconProps> = ({
xhr.open('GET', `${baseUrl}/${name}.svg`);
xhr.send();
xhr.onload = function onload() {
setLoadingStatus(LoadingStatus.SUCCESS);
const svg = xhr.response;

if (svg.startsWith('<svg')) {
setLoadingStatus(LoadingStatus.SUCCESS);
setIcon(svg);
}
};
Expand All @@ -75,7 +75,9 @@ export const CDNIcon: React.FC<CDNIconProps> = ({
return (
<span
style={{ color }}
className={cn(styles.component, className, { [styles.parentColor]: monoIcon })}
className={cn('cc-cdn-icon', styles.component, className, {
[styles.parentColor]: monoIcon,
})}
data-test-id={dataTestId}
{...(loadingStatus === LoadingStatus.FAILURE
? { children: fallback }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
left: 50%;
transform: translate(-50%, -50%);

& svg {
& svg,
:global(.cc-cdn-icon) {
width: 100%;
height: 100%;
}
Expand Down

0 comments on commit f83ccb5

Please sign in to comment.