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

UI: Fix brandImage visibility for unsized SVGs #13370

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/ui/src/components/sidebar/Brand.tsx
Expand Up @@ -18,6 +18,7 @@ export const Img = styled.img({

export const LogoLink = styled.a(({ theme }) => ({
display: 'inline-block',
width: '100%',
height: '100%',
margin: '-3px -4px',
padding: '2px 3px',
Expand Down
54 changes: 54 additions & 0 deletions lib/ui/src/components/sidebar/Heading.stories.tsx
Expand Up @@ -131,3 +131,57 @@ export const customBrandImage = () => {
</ThemeProvider>
);
};

export const customBrandImageTall = () => {
const theme = useTheme() as Theme;
return (
<ThemeProvider
theme={{
...theme,
brand: {
title: 'My Title',
url: 'https://example.com',
image: 'https://via.placeholder.com/100x150',
},
}}
>
<Heading menu={menuItems} />
</ThemeProvider>
);
};

export const customBrandImageUnsizedSVG = () => {
const theme = useTheme() as Theme;
return (
<ThemeProvider
theme={{
...theme,
brand: {
title: 'My Title',
url: 'https://example.com',
image: 'https://s.cdpn.io/91525/potofgold.svg',
},
}}
>
<Heading menu={menuItems} />
</ThemeProvider>
);
};

export const noBrand = () => {
const theme = useTheme() as Theme;
return (
<ThemeProvider
theme={{
...theme,
brand: {
title: null,
url: null,
image: null,
},
}}
>
<Heading menu={menuItems} />
</ThemeProvider>
);
};
2 changes: 1 addition & 1 deletion lib/ui/src/components/sidebar/Heading.tsx
Expand Up @@ -13,7 +13,7 @@ const BrandArea = styled.div(({ theme }) => ({
fontSize: theme.typography.size.s2,
fontWeight: theme.typography.weight.bold,
color: theme.color.defaultText,
marginRight: 40,
marginRight: 20,
display: 'flex',
width: '100%',
alignItems: 'center',
Expand Down