feat(heading): control text-shadow

This commit is contained in:
2021-01-30 18:36:58 +00:00
parent 64d3daef49
commit 2803288f5f
3 changed files with 29 additions and 12 deletions

View File

@@ -81,12 +81,7 @@ export default function HeaderLogo({ transition }) {
<LogoArrows /> <LogoArrows />
</Top> </Top>
<Middle visible={visible}> <Middle visible={visible}>
<Heading <Heading shadow="xl-white" noMargin noWrap>
shadowRadius="15px"
shadowColor="rgba(255, 255, 255, 0.25)"
noMargin
noWrap
>
ABC Project Design Ltd ABC Project Design Ltd
</Heading> </Heading>
<Text size="lg" noMargin> <Text size="lg" noMargin>

View File

@@ -5,8 +5,7 @@ import { css } from "@emotion/react";
const Styles = styled.h1` const Styles = styled.h1`
margin: ${props => (props.noMargin ? 0 : `0 0 var(--spacing-y-sm)`)}; margin: ${props => (props.noMargin ? 0 : `0 0 var(--spacing-y-sm)`)};
font-size: ${props => `var(--font-size-${props.size})`}; font-size: ${props => `var(--font-size-${props.size})`};
text-shadow: 0 0 ${props => props.shadowRadius || `2px`} text-shadow: 0 0 ${props => props.shadowSize} ${props => props.shadowColor};
${props => props.shadowColor || `rgba(0, 0, 0, 0.25)`};
${props => ${props =>
props.color && props.color &&
css` css`
@@ -28,10 +27,33 @@ const sizes = {
h6: "lg" h6: "lg"
}; };
export default function Heading({ el = "h1", children, ...other }) { const shadowSizes = {
sm: "2px",
md: "5px",
lg: "10px",
xl: "15px"
};
const shadowColors = {
white: "rgba(255, 255, 255, 0.25)",
black: "rgba(0, 0, 0, 0.25)"
};
export default function Heading({
el = "h1",
shadow = "sm-black",
children,
...other
}) {
const Container = Styles.withComponent(el); const Container = Styles.withComponent(el);
const [size, color] = shadow.split("-");
return ( return (
<Container size={sizes[el]} {...other}> <Container
size={sizes[el]}
shadowSize={shadowSizes[size]}
shadowColor={shadowColors[color]}
{...other}
>
{children} {children}
</Container> </Container>
); );

View File

@@ -10,8 +10,8 @@ export default function Index({ data }) {
image={data.headerImage.childImageSharp.fluid} image={data.headerImage.childImageSharp.fluid}
position="bottom right" position="bottom right"
> >
<Heading> <Heading shadow="xl-white">
Slogan <em>or quote here</em> <em>Easy as</em> ABC
</Heading> </Heading>
</Header> </Header>
<Section heading="About ABC Project Design"> <Section heading="About ABC Project Design">