Skip to content

Commit 439c854

Browse files
Swap the css icon to use the new official one (#660)
* fix: update css icon, fix remote svg icon content * docs(changeset): Fix RemoteSvgIcon inner content * docs(changeset): Fix WindowTab attributes
1 parent 4ed8ff1 commit 439c854

File tree

6 files changed

+32
-3
lines changed

6 files changed

+32
-3
lines changed

.changeset/cold-parents-attack.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@codeimage/ui': patch
3+
---
4+
5+
Fix RemoteSvgIcon inner content

.changeset/wise-coins-decide.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@codeimage/config': patch
3+
---
4+
5+
Fix WindowTab attributes

apps/codeimage/src/components/Terminal/Tabs/Tab/WindowTab.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ export interface WindowTabProps {
2929
export function WindowTab(
3030
props: ParentProps<WindowTabProps & JSX.IntrinsicElements['div']>,
3131
) {
32-
const [, others] = splitProps(props, ['class', 'ref', 'style']);
32+
const [, others] = splitProps(props, [
33+
'class',
34+
'ref',
35+
'style',
36+
'rightContent',
37+
'content',
38+
]);
3339

3440
return (
3541
<div

packages/config/src/lib/base/languages.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ export const SUPPORTED_LANGUAGES: readonly LanguageDefinition[] = [
284284
{
285285
name: 'css',
286286
extension: '.css',
287-
content: () => import('material-icon-theme/icons/css.svg?raw'),
287+
content: () => import('../icons/css.svg?raw'),
288288
matcher: /^.*\.(css)$/,
289289
},
290290
{

packages/config/src/lib/icons/css.svg

+6
Loading

packages/ui/src/lib/primitives/Icon/RemoteSvgIcon.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,15 @@ export function RemoteSvgIcon(props: SvgExternalIconProps): JSXElement {
5252

5353
const innerHTML = randomizeSvgUrlIds(svgResponse);
5454

55-
return {
55+
const parsedDocument = new DOMParser().parseFromString(
5656
innerHTML,
57+
'text/html',
58+
);
59+
const svg = parsedDocument.body.childNodes[0] as SVGElement;
60+
61+
return {
62+
innerHTML: (svg as SVGElement).innerHTML,
63+
viewBox: svg.getAttribute('viewBox') || undefined,
5764
};
5865
});
5966

0 commit comments

Comments
 (0)