Skip to content

Commit

Permalink
Use wordmark instead of logo inside the modal (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
vinnyjth authored Jan 24, 2024
1 parent d57d328 commit 11082d2
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 8 deletions.
20 changes: 12 additions & 8 deletions packages/web-shared/components/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ import {
useBreadcrumbDispatch,
} from '../../providers/BreadcrumbProvider';
import { X } from 'phosphor-react';
import Logo from '../Logo';
import Wordmark from '../Wordmark';

function ChurchLogo(props) {
const { currentChurch } = useCurrentChurch();
return <Logo source={currentChurch?.logo} theme={currentChurch?.theme} padding={10} {...props} />;
return <Wordmark source={currentChurch?.wordmarkLightUrl} padding={10} {...props} />;
return null;
}

const Modal = (props = {}) => {
Expand Down Expand Up @@ -61,11 +62,11 @@ const Modal = (props = {}) => {
width="100%"
display="flex"
mb="s"
alignItems="flex-start"
justifyContent="space-between"
mt="s"
alignItems="center"
justifyContent="center"
flexDirection={{ _: 'column-reverse', sm: 'row' }}
>
<Box width={{ _: '0', sm: '10%' }}></Box>
<ChurchLogo
display="flex"
alignSelf="center"
Expand All @@ -75,19 +76,22 @@ const Modal = (props = {}) => {
size="60px"
borderRadius="xl"
/>
<Box
</Box>
<Box
width={{ _: '100%', sm: '10%' }}
mb={{ _: 'xs', sm: '0' }}
ml={{ _: '0', sm: 'xs' }}
display="flex"
justifyContent="flex-end"
alignItems="center"
position="absolute"
top="xs"
right="xs"
>
<Styled.Icon onClick={handleCloseModal} ml={{ _: 'auto', sm: '0' }}>
<X size={16} weight="bold" />
</Styled.Icon>
</Box>
</Box>
</Box>
<Box
width="100%"
display="flex"
Expand Down
1 change: 1 addition & 0 deletions packages/web-shared/components/Modal/Modal.styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const ModalContainer = withTheme(styled.div`
@media screen and (max-width: ${themeGet('breakpoints.sm')}) {
padding: 16px;
}
position: relative;
${system};
`);

Expand Down
21 changes: 21 additions & 0 deletions packages/web-shared/components/Wordmark/Wordmark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import PropTypes from 'prop-types';
import { withTheme } from 'styled-components';
import Styled from './Wordmark.styles';

import { systemPropTypes } from '../../ui-kit';

function Wordmark({ size, source }) {

return (
<Styled.Image src={source || './icon.png'} alt="Logo" size={size} />
);
}

Wordmark.propTypes = {
...systemPropTypes,
size: PropTypes.number,
source: PropTypes.string,
};

export default withTheme(Wordmark);
24 changes: 24 additions & 0 deletions packages/web-shared/components/Wordmark/Wordmark.styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { withTheme } from 'styled-components';
import styled, { css } from 'styled-components';;

const DEFAULT_ICON_SIZE = '80px';

const imageStyles = ({ size }) => {
const newSize = size || DEFAULT_ICON_SIZE;

return css`
max-height: ${newSize};
max-width: 80%;
`;
};

const Image = withTheme(styled.img`
resizemode: 'contain';
${imageStyles};
`);

const Styled = {
Image,
};

export default Styled;
3 changes: 3 additions & 0 deletions packages/web-shared/components/Wordmark/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Wordmark from './Wordmark';

export default Wordmark;
1 change: 1 addition & 0 deletions packages/web-shared/hooks/useCurrentChurch.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const GET_CURRENT_CHURCH = gql`
slug
theme
logo
wordmarkLightUrl
}
}
`;
Expand Down

0 comments on commit 11082d2

Please sign in to comment.