Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code styling #881

Merged
merged 2 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/custom/Markdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
BasicAnchorMarkdown,
StyledMarkdown,
StyledMarkdownBlockquote,
StyledMarkdownCode,
StyledMarkdownH1,
StyledMarkdownH2,
StyledMarkdownH3,
Expand Down Expand Up @@ -54,7 +55,8 @@ export const RenderMarkdown: React.FC<RenderMarkdownProps> = ({ content }) => {
li: ({ ...props }) => <StyledMarkdownLi>{props.children}</StyledMarkdownLi>,
th: ({ ...props }) => <StyledMarkdownTh>{props.children}</StyledMarkdownTh>,
td: ({ ...props }) => <StyledMarkdownTd>{props.children}</StyledMarkdownTd>,
pre: ({ ...props }) => <StyledMarkdownPre>{props.children}</StyledMarkdownPre>
pre: ({ ...props }) => <StyledMarkdownPre>{props.children}</StyledMarkdownPre>,
code: ({ ...props }) => <StyledMarkdownCode>{props.children}</StyledMarkdownCode>
}}
>
{content}
Expand Down
9 changes: 9 additions & 0 deletions src/custom/Markdown/style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,12 @@ export const StyledMarkdownPre = styled('pre')(({ theme }) => ({
whiteSpace: 'pre-line',
fontFamily: 'inherit'
}));

export const StyledMarkdownCode = styled('code')(({ theme }) => ({
background: theme.palette.background.code,
whiteSpace: 'pre-line',
padding: '1.5px',
paddingInline: '5px',
fontFamily: 'inherit',
borderRadius: 3
}));
1 change: 1 addition & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export * from './icons';
export * from './redux-persist';
export * from './schemas';
export * from './theme';
export * from './utils';
3 changes: 2 additions & 1 deletion src/theme/palette.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ export const lightModePalette: PaletteOptions = {
tertiary: Colors.red[70]
},
code: Colors.charcoal[90],

constant: {
white: Colors.accentGrey[100],
disabled: Colors.charcoal[70],
Expand Down Expand Up @@ -369,7 +370,7 @@ export const darkModePalette: PaletteOptions = {
secondary: Colors.red[20],
tertiary: Colors.red[10]
},
code: Colors.accentGrey[90],
code: Colors.charcoal[10],
constant: {
white: Colors.accentGrey[100],
disabled: Colors.charcoal[70],
Expand Down
6 changes: 6 additions & 0 deletions src/utils/components.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const componentIcon = ({ kind, model, color }) => {

Check failure on line 1 in src/utils/components.ts

View workflow job for this annotation

GitHub Actions / checks (16)

Binding element 'kind' implicitly has an 'any' type.

Check failure on line 1 in src/utils/components.ts

View workflow job for this annotation

GitHub Actions / checks (16)

Binding element 'model' implicitly has an 'any' type.

Check failure on line 1 in src/utils/components.ts

View workflow job for this annotation

GitHub Actions / checks (16)

Binding element 'color' implicitly has an 'any' type.

Check failure on line 1 in src/utils/components.ts

View workflow job for this annotation

GitHub Actions / checks (20)

Binding element 'kind' implicitly has an 'any' type.

Check failure on line 1 in src/utils/components.ts

View workflow job for this annotation

GitHub Actions / checks (20)

Binding element 'model' implicitly has an 'any' type.

Check failure on line 1 in src/utils/components.ts

View workflow job for this annotation

GitHub Actions / checks (20)

Binding element 'color' implicitly has an 'any' type.
if (!kind || !model || !color) {
return null;
}
return `/ui/public/static/img/meshmodels/${model}/${color}/${kind.toLowerCase()}-${color}.svg`;
};
1 change: 1 addition & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './components';
Loading