Skip to content

Commit

Permalink
fix(fuselage): remove codeBlock palette and add palette prop (#1383)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliajforesti authored May 24, 2024
1 parent f2aa3f0 commit 5870a93
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 84 deletions.
5 changes: 5 additions & 0 deletions .changeset/curvy-rules-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/fuselage": patch
---

fix(fuselage): remove `codeBlock` palette and add `palette` prop for a custom palette
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { createPortal } from 'react-dom';

import { convertToCss } from './helpers/convertToCss';
import { useCreateStyleContainer } from './hooks/useCreateStyleContainer';
import { codeBlock } from './lib/codeBlockStyles';
import { dark, highContrast, light } from './lib/themePalettes';
import type { Themes } from './types/themes';

Expand All @@ -18,6 +17,7 @@ export const PaletteStyleTag = memo(function PaletteStyleTag({
tagId = 'main-palette',
prefix = '--rcx-color',
selector,
palette,
}: {
theme?: Themes;
/**
Expand All @@ -32,17 +32,14 @@ export const PaletteStyleTag = memo(function PaletteStyleTag({
* Default is `:root`.
*/
selector?: string;
/**
* CSS containing custom palette styles to be used.
*/
palette?: string;
}) {
const palette = convertToCss(themes[theme], prefix, selector);
const themePalette = palette || convertToCss(themes[theme], prefix, selector);

return (
<>
{createPortal(
theme === 'dark' ? palette + codeBlock : palette,
useCreateStyleContainer(tagId)
)}
</>
);
return <>{createPortal(themePalette, useCreateStyleContainer(tagId))}</>;
});

export default PaletteStyleTag;

This file was deleted.

0 comments on commit 5870a93

Please sign in to comment.