In React I have an inline-flex
parent element that contains a hyperlinked image and a support email URL. I want the support email URL element's width to MANDATE the width of the parent element and subsequently of the image as well. Meaning all the element width's must be the same as the support element's width.
This is what I have so far but it's not working. I'm not very good at CSS:
import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
const ProviderContainer = styled.div`
margin: auto
align-items: center;
justify-content: center;
display: inline-flex;
flex-direction: column;
font-family: Lato;
font-size: 22px;
font-weight: normal;
font-style: normal;
font-stretch: normal;
line-height: normal;
letter-spacing: normal;
border: 2px solid;
border-color: #747162;
`;
const ProviderSupport = styled.a`
margin:10px 0;
display: inline-table;
border: 2px solid;
border-color: #747162;
`
const ImageContainer = styled.div`
border: 2px solid;
border-color: #747162;
flex-basis: 100%
`
const Provider = (props) => (
<ProviderContainer>
<ImageContainer>
<a href={props.ProviderLink}>
<img style={{width:'100%'}} src={props.ProviderLogo}></img>
</a>
</ImageContainer>
<ProviderSupport href={`mailto:${props.ProviderSupport}`}>{props.ProviderSupport}</ProviderSupport>
</ProviderContainer>
);
Provider.propTypes = {
ProviderLink: PropTypes.string,
ProviderLogo: PropTypes.string,
ProviderSupport: PropTypes.string
};
export default Provider;
The borders are just so I can get an idea of the box size
This is the issue that can pop up if the image is too big:
Here's a transpiled fiddle example: https://jsfiddle.net/uj5d4621/2/