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

Use wordmark instead of logo inside the modal #146

Merged
merged 2 commits into from
Jan 24, 2024
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
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
Loading