The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
import { styled } from '@linaria/react';
import { type IconComponentProps } from 'twenty-ui/icon';
import { useTheme } from 'twenty-ui/theme';
type ModelsDevProviderLogoProps = {
logoUrl: string;
} & Pick<IconComponentProps, 'className' | 'size' | 'style'>;
const resolvePixelSize = (
size: IconComponentProps['size'] | undefined,
): number => {
if (typeof size === 'number') {
return size;
}
if (typeof size === 'string') {
const parsed = parseInt(size, 10);
return Number.isNaN(parsed) ? 16 : parsed;
}
return 16;
};
const StyledLogo = styled.img`
object-fit: contain;
`;
export const ModelsDevProviderLogo = ({
logoUrl,
size,
className,
style,
}: ModelsDevProviderLogoProps) => {
const theme = useTheme();
const pixelSize = resolvePixelSize(size);
const isLightTheme = theme.name === 'light';
return (
<StyledLogo
alt=""
className={className}
height={pixelSize}
src={logoUrl}
style={{
...style,
filter: isLightTheme ? 'none' : 'invert(1)',
}}
width={pixelSize}
/>
);
};