mirror of
https://github.com/owncast/owncast.git
synced 2025-11-03 21:08:36 +08:00
Fix logo to support non-square sizes
This commit is contained in:
@ -83,7 +83,7 @@ export default function ContentComponent() {
|
|||||||
</ActionButtonRow>
|
</ActionButtonRow>
|
||||||
|
|
||||||
<div className={`${s.lowerRow}`}>
|
<div className={`${s.lowerRow}`}>
|
||||||
<ServerLogo />
|
<ServerLogo src="/logo" />
|
||||||
<Title level={2}>{name}</Title>
|
<Title level={2}>{name}</Title>
|
||||||
{online && title !== '' && <Title level={3}>{title}</Title>}
|
{online && title !== '' && <Title level={3}>{title}</Title>}
|
||||||
<div>{tags.length > 0 && tags.map(tag => <span key={tag}>#{tag} </span>)}</div>
|
<div>{tags.length > 0 && tags.map(tag => <span key={tag}>#{tag} </span>)}</div>
|
||||||
|
|||||||
@ -1,9 +1,29 @@
|
|||||||
.logo {
|
.logo {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
overflow: hidden;
|
||||||
width: 120px;
|
width: 120px;
|
||||||
|
height: 120px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
border-width: 3px;
|
border-width: 3px;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-color: var(--theme-primary-color);
|
border-color: var(--theme-primary-color);
|
||||||
background-color: var(--theme-background-secondary);
|
background-color: var(--theme-background-secondary);
|
||||||
padding: 3px;
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
width: 90%;
|
||||||
|
height: 90%;
|
||||||
|
border-radius: 50%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
@ -1,5 +1,15 @@
|
|||||||
import s from './Logo.module.scss';
|
import s from './Logo.module.scss';
|
||||||
|
|
||||||
export default function SocialLinks() {
|
interface Props {
|
||||||
return <img className={s.logo} src="/logo" alt="logo" />;
|
src: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Logo({ src }: Props) {
|
||||||
|
return (
|
||||||
|
<div className={s.logo}>
|
||||||
|
<div className={s.container}>
|
||||||
|
<div className={s.image} style={{ backgroundImage: `url(${src})` }} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
23
web/stories/HeaderLogo.stories.tsx
Normal file
23
web/stories/HeaderLogo.stories.tsx
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
||||||
|
import { OwncastLogo } from '../components/common';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
title: 'owncast/Components/Header Logo',
|
||||||
|
component: OwncastLogo,
|
||||||
|
parameters: {},
|
||||||
|
} as ComponentMeta<typeof OwncastLogo>;
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
const Template: ComponentStory<typeof OwncastLogo> = args => <OwncastLogo {...args} />;
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
export const Logo = Template.bind({});
|
||||||
|
Logo.args = {
|
||||||
|
url: '/logo',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const DemoServer = Template.bind({});
|
||||||
|
DemoServer.args = {
|
||||||
|
url: 'https://watch.owncast.online/logo',
|
||||||
|
};
|
||||||
@ -1,23 +1,28 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
||||||
import { OwncastLogo } from '../components/common';
|
import Logo from '../components/ui/Logo/Logo';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
title: 'owncast/Components/Logo',
|
title: 'owncast/Components/Page Logo',
|
||||||
component: OwncastLogo,
|
component: Logo,
|
||||||
parameters: {},
|
parameters: {},
|
||||||
} as ComponentMeta<typeof OwncastLogo>;
|
} as ComponentMeta<typeof Logo>;
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
const Template: ComponentStory<typeof OwncastLogo> = args => <OwncastLogo {...args} />;
|
const Template: ComponentStory<typeof Logo> = args => <Logo {...args} />;
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
export const Logo = Template.bind({});
|
export const LocalServer = Template.bind({});
|
||||||
Logo.args = {
|
LocalServer.args = {
|
||||||
url: '/logo',
|
src: 'http://localhost:8080/logo',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DemoServer = Template.bind({});
|
export const DemoServer = Template.bind({});
|
||||||
DemoServer.args = {
|
DemoServer.args = {
|
||||||
url: 'https://watch.owncast.online/logo',
|
src: 'https://watch.owncast.online/logo',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const RandomImage = Template.bind({});
|
||||||
|
RandomImage.args = {
|
||||||
|
src: 'https://picsum.photos/600/500',
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user