-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
77 additions
and
86 deletions.
There are no files selected for viewing
29 changes: 0 additions & 29 deletions
29
apps/enterprise/src/components/dao-logo/DAOLogo.module.sass
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,62 @@ | ||
import classNames from 'classnames'; | ||
import { SafeImage } from 'components/safe-image/SafeImage'; | ||
import { forwardRef } from 'react'; | ||
import { ReactComponent as LogoIcon } from 'components/assets/LogoSmall.svg'; | ||
import styles from './DAOLogo.module.sass'; | ||
import styled from 'styled-components'; | ||
import { roundedCSS } from 'lib/ui/utils/roundedCSS'; | ||
import { centerContentCSS } from 'lib/ui/utils/centerContentCSS'; | ||
import { Text } from 'lib/ui/Text'; | ||
import { getSameDimensionsCSS } from 'lib/ui/utils/getSameDimensionsCSS'; | ||
|
||
type Variant = 'small' | 'large'; | ||
export const daoLogoSizes = ['s', 'm', 'l'] as const; | ||
|
||
type DaoLogoSize = typeof daoLogoSizes[number]; | ||
|
||
const logoSizeRecord: Record<DaoLogoSize, number> = { | ||
s: 40, | ||
m: 48, | ||
l: 60 | ||
} | ||
|
||
interface DAOLogoProps { | ||
className?: string; | ||
variant?: Variant; | ||
logo: string | undefined; | ||
onClick?: () => void; | ||
logo?: string | ||
size?: DaoLogoSize | ||
className?: string | ||
} | ||
|
||
const Container = styled.div<{ size: DaoLogoSize }>` | ||
background: ${({ theme }) => theme.colors.backgroundGlass.toCssValue()}; | ||
${roundedCSS}; | ||
${centerContentCSS}; | ||
padding: 8px; | ||
height: ${({ size }) => getSameDimensionsCSS(logoSizeRecord[size])}; | ||
img { | ||
object-fit: cover; | ||
${({ size }) => getSameDimensionsCSS(logoSizeRecord[size] * 0.64)}; | ||
} | ||
` | ||
|
||
|
||
export const DAOLogo = forwardRef<any, DAOLogoProps>((props, ref) => { | ||
const { className, variant = 'small', logo, onClick, ...rest } = props; | ||
const { logo, size = 'm', className } = props; | ||
|
||
return ( | ||
<div | ||
className={classNames(className, styles.root, { | ||
[styles.link]: Boolean(onClick), | ||
})} | ||
<Container | ||
ref={ref} | ||
onClick={onClick} | ||
data-variant={variant} | ||
{...rest} | ||
size={size} | ||
className={className} | ||
> | ||
<SafeImage | ||
fallback={<LogoIcon className={styles.placeholder} />} | ||
fallback={( | ||
<Text size={20} color="supporting"> | ||
<LogoIcon /> | ||
</Text> | ||
)} | ||
src={logo} | ||
render={(params) => <img ref={ref} {...params} alt="" />} | ||
/> | ||
</div> | ||
</Container> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters