Browse Source

fix: image aspect ratio, code spacing

fix/enable-imgix
Thomas Osmonson 5 years ago
parent
commit
72c53ac19a
  1. 34
      src/components/custom-blocks/page-reference.tsx
  2. 2
      src/components/mdx/components/code.tsx

34
src/components/custom-blocks/page-reference.tsx

@ -6,7 +6,7 @@ import { Caption, Text } from '@components/typography';
import Link from 'next/link'; import Link from 'next/link';
import routes from '@common/routes'; import routes from '@common/routes';
import { Img } from '@components/mdx/image'; import { Img } from '@components/mdx/image';
import { css } from '@styled-system/css';
const Image = ({ const Image = ({
src, src,
isHovered, isHovered,
@ -130,15 +130,26 @@ const GridCard: React.FC<BoxProps & { page?: any }> = ({ page, ...rest }) => {
}); });
return ( return (
<Box position="relative" {...rest} {...bind}> <Box position="relative" {...rest} {...bind}>
<Box borderRadius="12px" overflow="hidden" mb={space('loose')}> <Box
<Image bg="#9985FF"
width="100%" position="relative"
size="100%" borderRadius="12px"
transition={transition('0.45s')} mb={space('loose')}
transform={(hover || active) && 'scale(1.08)'} overflow="hidden"
style={{ willChange: 'transform' }} >
src={page?.images?.large} <Grid style={{ placeItems: 'center' }} height="0px" paddingTop="56.25%">
/> <Image
width="102%"
size="102%"
transition={transition('0.45s')}
transform={(hover || active) && 'scale(1.08)'}
style={{ willChange: 'transform' }}
src={page?.images?.large}
position="absolute"
left={'-2%'}
top={'-2%'}
/>
</Grid>
</Box> </Box>
<Flex alignItems="flex-start" justifyContent="flex-start" flexDirection="column"> <Flex alignItems="flex-start" justifyContent="flex-start" flexDirection="column">
<Title color={hover ? color('accent') : color('text-title')} mb={space('tight')}> <Title color={hover ? color('accent') : color('text-title')} mb={space('tight')}>
@ -166,7 +177,8 @@ export const PageReference = ({ children }) => {
gridRowGap={space('loose')} gridRowGap={space('loose')}
gridTemplateColumns={[ gridTemplateColumns={[
`repeat(1, 1fr)`, `repeat(1, 1fr)`,
`repeat(1, 1fr)`, `repeat(${pages.length === 1 ? 1 : 2}, 1fr)`,
`repeat(${pages.length === 1 ? 1 : 2}, 1fr)`,
`repeat(${pages.length === 1 ? 1 : 3}, 1fr)`, `repeat(${pages.length === 1 ? 1 : 3}, 1fr)`,
]} ]}
> >

2
src/components/mdx/components/code.tsx

@ -79,7 +79,7 @@ export const Code: React.FC<
pr: space(['base-loose', 'base-loose', 'extra-loose', 'extra-loose']), pr: space(['base-loose', 'base-loose', 'extra-loose', 'extra-loose']),
pl: pl:
lines <= LINE_MINIMUM || lang === 'bash' lines <= LINE_MINIMUM || lang === 'bash'
? space(['base-loose', 'base-loose', 'base-loose', 'base-loose']) ? space(['extra-loose', 'extra-loose', 'base-loose', 'base-loose'])
: 'unset', : 'unset',
})} })}
{...rest} {...rest}

Loading…
Cancel
Save