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

Style and Padding fixes for page designer #1023

Merged
merged 1 commit into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
*/
import React from 'react'
import PropTypes from 'prop-types'
import {Box, Image, Link, Text} from '@chakra-ui/react'
import {Box, Image, Text} from '@chakra-ui/react'
import Link from '../../../components/link'

/**
* Image with text component
Expand Down Expand Up @@ -54,6 +55,8 @@ export const ImageWithText = ({ITCLink, ITCText, image, heading, alt}) => {
position={'absolute'}
top={'50%'}
width={'100%'}
padding={'15px'}
textAlign={{base: 'center', sm: 'left'}}
>
<Text
as="span"
Expand All @@ -67,6 +70,10 @@ export const ImageWithText = ({ITCLink, ITCText, image, heading, alt}) => {
__html: heading
}}
sx={{
['h1, h2, h3, h4, h5, h6']: {
fontSize: 'revert',
fontWeight: 'revert'
},
p: {
display: 'flex',
alignItems: 'center',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,21 @@ export const Carousel = (props = {}) => {
}
}, [hasOverflow])

const itemSpacing = 4
// Calculate the width of each item in the carousel, accounting for the spacing between the items.
const itemWidth = {
base: `calc(${100 / xsCarouselSlidesToDisplay}%)`,
sm: `calc(${100 / xsCarouselSlidesToDisplay}%)`,
md: `calc(${100 / smCarouselSlidesToDisplay}%)`,
lg: `calc(${100 / mdCarouselSlidesToDisplay}%)`
base: `calc(${100 / xsCarouselSlidesToDisplay}% - ${
((xsCarouselSlidesToDisplay - 1) * (itemSpacing * 4)) / xsCarouselSlidesToDisplay
}px)`,
sm: `calc(${100 / xsCarouselSlidesToDisplay}% - ${
((xsCarouselSlidesToDisplay - 1) * (itemSpacing * 4)) / xsCarouselSlidesToDisplay
}px)`,
md: `calc(${100 / smCarouselSlidesToDisplay}% - ${
((smCarouselSlidesToDisplay - 1) * (itemSpacing * 4)) / smCarouselSlidesToDisplay
}px)`,
lg: `calc(${100 / mdCarouselSlidesToDisplay}% - ${
((mdCarouselSlidesToDisplay - 1) * (itemSpacing * 4)) / mdCarouselSlidesToDisplay
}px)`
}

const overflowXScroll = {
Expand Down Expand Up @@ -126,7 +136,7 @@ export const Carousel = (props = {}) => {
className={'carousel-container-items scroll-indicator'}
data-testid="carousel-container-items"
direction="row"
spacing={0}
spacing={itemSpacing}
wrap="nowrap"
overflowX="scroll"
sx={{
Expand All @@ -142,7 +152,7 @@ export const Carousel = (props = {}) => {
width={itemWidth}
style={{scrollSnapAlign: 'start'}}
>
<AspectRatio ratio={1}>
<AspectRatio ratio={0.75}>
<Component component={component} />
</AspectRatio>
</Box>
Expand All @@ -156,15 +166,17 @@ export const Carousel = (props = {}) => {
display={controlDisplay}
position="absolute"
top="50%"
left={{base: 0, lg: 4}}
left={{base: 1, lg: 4}}
transform="translateY(-50%)"
>
{/* boxShadow requires !important --> https://github.com/chakra-ui/chakra-ui/issues/3553 */}
<IconButton
data-testid="carousel-nav-left"
aria-label="Scroll carousel left"
icon={<ChevronLeftIcon color="black" />}
borderRadius="full"
colorScheme="whiteAlpha"
boxShadow={'0 3px 10px rgb(0 0 0 / 20%) !important'}
onClick={() => scroll(-1)}
/>
</Box>
Expand All @@ -173,15 +185,17 @@ export const Carousel = (props = {}) => {
display={controlDisplay}
position="absolute"
top="50%"
right={{base: 0, lg: 4}}
right={{base: 1, lg: 4}}
transform="translateY(-50%)"
>
{/* boxShadow requires !important --> https://github.com/chakra-ui/chakra-ui/issues/3553 */}
<IconButton
data-testid="carousel-nav-right"
aria-label="Scroll carousel right"
icon={<ChevronRightIcon color="black" />}
borderRadius="full"
colorScheme="whiteAlpha"
boxShadow={'0 3px 10px rgb(0 0 0 / 20%) !important'}
onClick={() => scroll(1)}
/>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {Region, regionType} from '../../core'
* @returns {React.ReactElement} - Grid component.
*/
export const MobileGrid2r1c = ({regions}) => (
<SimpleGrid className="mobile-2r-1c" columns={{base: 1, sm: 2}}>
<SimpleGrid className="mobile-2r-1c" columns={{base: 1, sm: 2}} gridGap={4}>
{regions.map((region) => (
<Region key={region.id} region={region} />
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {Region, regionType} from '../../core'
* @returns {React.ReactElement} - Grid component.
*/
export const MobileGrid2r2c = ({regions}) => (
<SimpleGrid className="mobile-2r-2c" columns={{base: 2, sm: 4}}>
<SimpleGrid className="mobile-2r-2c" columns={{base: 2, sm: 4}} gridGap={4}>
{regions.map((region) => (
<Region key={region.id} region={region} />
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {Region, regionType} from '../../core'
* @returns {React.ReactElement} - Grid component.
*/
export const MobileGrid2r3c = ({regions}) => (
<SimpleGrid className="mobile-2r-3c" columns={{base: 3, sm: 6}}>
<SimpleGrid className="mobile-2r-3c" columns={{base: 3, sm: 6}} gridGap={4}>
{regions.map((region) => (
<Region key={region.id} region={region} />
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {Region, regionType} from '../../core'
* @returns {React.ReactElement} - Grid component.
*/
export const MobileGrid3r1c = ({regions}) => (
<SimpleGrid className="mobile-3r-1c" columns={{base: 1, sm: 3}}>
<SimpleGrid className="mobile-3r-1c" columns={{base: 1, sm: 3}} gridGap={4}>
{regions.map((region) => (
<Region key={region.id} region={region} />
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {Region, regionType} from '../../core'
* @returns {React.ReactElement} - Grid component.
*/
export const MobileGrid3r2c = ({regions}) => (
<SimpleGrid className="mobile-3r-2c" columns={{base: 2, sm: 3}}>
<SimpleGrid className="mobile-3r-2c" columns={{base: 2, sm: 3}} gridGap={4}>
{regions.map((region) => (
<Region key={region.id} region={region} />
))}
Expand Down