Skip to content

Commit

Permalink
Wordmark Links to homepage (#147)
Browse files Browse the repository at this point in the history
* Use wordmark instead of logo inside the modal

* Added support for wordmark linking to homepage
  • Loading branch information
vinnyjth authored Jan 24, 2024
1 parent 11082d2 commit 6c2dfa6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
8 changes: 6 additions & 2 deletions packages/web-shared/components/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ import Wordmark from '../Wordmark';

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

const { origin } = window.location;

return (
<Wordmark source={currentChurch?.wordmarkLightUrl} padding={10} {...props} href={origin} />
);
}

const Modal = (props = {}) => {
Expand Down
13 changes: 9 additions & 4 deletions packages/web-shared/components/Wordmark/Wordmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ import Styled from './Wordmark.styles';

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

function Wordmark({ size, source }) {
function Wordmark({ size, source, href }) {
if (href) {
return (
<a href={href}>
<Styled.WrappedImage src={source || './icon.png'} alt="Logo" size={size} />
</a>
);
}

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

Wordmark.propTypes = {
Expand Down
11 changes: 9 additions & 2 deletions packages/web-shared/components/Wordmark/Wordmark.styles.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { withTheme } from 'styled-components';
import styled, { css } from 'styled-components';;
import styled, { css } from 'styled-components';

const DEFAULT_ICON_SIZE = '80px';

Expand All @@ -8,17 +8,24 @@ const imageStyles = ({ size }) => {

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

const Image = withTheme(styled.img`
resizemode: 'contain';
max-width: 80%;
${imageStyles};
`);

const WrappedImage = withTheme(styled.img`
resizemode: 'contain';
max-width: 100%;
${imageStyles};
`);

const Styled = {
Image,
WrappedImage,
};

export default Styled;

0 comments on commit 6c2dfa6

Please sign in to comment.