Skip to content

Commit 1697ee8

Browse files
authored
Merge pull request #881 from layer5io/code-styling
Code styling
2 parents 37284a3 + 89eed9c commit 1697ee8

File tree

6 files changed

+22
-2
lines changed

6 files changed

+22
-2
lines changed

src/custom/Markdown/index.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
BasicAnchorMarkdown,
66
StyledMarkdown,
77
StyledMarkdownBlockquote,
8+
StyledMarkdownCode,
89
StyledMarkdownH1,
910
StyledMarkdownH2,
1011
StyledMarkdownH3,
@@ -54,7 +55,8 @@ export const RenderMarkdown: React.FC<RenderMarkdownProps> = ({ content }) => {
5455
li: ({ ...props }) => <StyledMarkdownLi>{props.children}</StyledMarkdownLi>,
5556
th: ({ ...props }) => <StyledMarkdownTh>{props.children}</StyledMarkdownTh>,
5657
td: ({ ...props }) => <StyledMarkdownTd>{props.children}</StyledMarkdownTd>,
57-
pre: ({ ...props }) => <StyledMarkdownPre>{props.children}</StyledMarkdownPre>
58+
pre: ({ ...props }) => <StyledMarkdownPre>{props.children}</StyledMarkdownPre>,
59+
code: ({ ...props }) => <StyledMarkdownCode>{props.children}</StyledMarkdownCode>
5860
}}
5961
>
6062
{content}

src/custom/Markdown/style.tsx

+9
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,12 @@ export const StyledMarkdownPre = styled('pre')(({ theme }) => ({
9898
whiteSpace: 'pre-line',
9999
fontFamily: 'inherit'
100100
}));
101+
102+
export const StyledMarkdownCode = styled('code')(({ theme }) => ({
103+
background: theme.palette.background.code,
104+
whiteSpace: 'pre-line',
105+
padding: '1.5px',
106+
paddingInline: '5px',
107+
fontFamily: 'inherit',
108+
borderRadius: 3
109+
}));

src/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ export * from './icons';
66
export * from './redux-persist';
77
export * from './schemas';
88
export * from './theme';
9+
export * from './utils';

src/theme/palette.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ export const lightModePalette: PaletteOptions = {
255255
tertiary: Colors.red[70]
256256
},
257257
code: Colors.charcoal[90],
258+
258259
constant: {
259260
white: Colors.accentGrey[100],
260261
disabled: Colors.charcoal[70],
@@ -369,7 +370,7 @@ export const darkModePalette: PaletteOptions = {
369370
secondary: Colors.red[20],
370371
tertiary: Colors.red[10]
371372
},
372-
code: Colors.accentGrey[90],
373+
code: Colors.charcoal[10],
373374
constant: {
374375
white: Colors.accentGrey[100],
375376
disabled: Colors.charcoal[70],

src/utils/components.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export const componentIcon = ({ kind, model, color }) => {
2+
if (!kind || !model || !color) {
3+
return null;
4+
}
5+
return `/ui/public/static/img/meshmodels/${model}/${color}/${kind.toLowerCase()}-${color}.svg`;
6+
};

src/utils/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './components';

0 commit comments

Comments
 (0)