Skip to content

Commit

Permalink
feat: Allows Logos to be exported, and adds ability to customise title (
Browse files Browse the repository at this point in the history
#701)

* Allows Logos to be exported, and adds ability to customise title

* Adds title to proptypes of Logos

* Adds animated and non-animated examples of Logos component

* Updates upload-artifact version

* Changes 'Logos' to 'LogoLinked' to distinguish from simple Logo
  • Loading branch information
curlyfriesplease authored Jan 31, 2025
1 parent f1bc8f8 commit f6aa54b
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import styled, { css } from 'styled-components';
import Logo from '../../Atoms/Logo/Logo';

const TitleLabel = styled.span`
line-height: 0;
line-height: 0;
font-size: 0;
color: transparent;
color: transparent;
`;

const LogoLink = styled.a`
Expand All @@ -25,8 +25,8 @@ const LogoLink = styled.a`
`}
`;

const Logos = ({
campaign = 'Comic Relief', animateRotate = false, sizeSm, sizeMd
const LogoLinked = ({
campaign = 'Comic Relief', title = 'Go to Comic Relief homepage', animateRotate = false, sizeSm, sizeMd
}) => {
if (campaign === 'Sport Relief Gameon') {
return (
Expand Down Expand Up @@ -62,18 +62,19 @@ const Logos = ({
}

return (
<LogoLink href="/" title="Go to Comic Relief homepage" animateRotate={animateRotate}>
<Logo rotate={false} campaign="Comic Relief" title="Go to Comic Relief homepage" sizeSm={sizeSm} sizeMd={sizeMd} />
<TitleLabel>Go to Comic Relief homepage</TitleLabel>
<LogoLink href="/" title={title} animateRotate={animateRotate}>
<Logo rotate={false} campaign="Comic Relief" title={title} sizeSm={sizeSm} sizeMd={sizeMd} />
<TitleLabel>{title}</TitleLabel>
</LogoLink>
);
};

Logos.propTypes = {
LogoLinked.propTypes = {
campaign: PropTypes.string,
animateRotate: PropTypes.bool,
title: PropTypes.string,
sizeSm: PropTypes.string,
sizeMd: PropTypes.string
};

export default Logos;
export default LogoLinked;
11 changes: 11 additions & 0 deletions src/components/Molecules/LogoLinked/LogoLinked.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Comic Relief Logo without animation

```js
<LogoLinked sizeSm="50px" sizeMd="60px" />
```

# Comic Relief Logo with hover animation and custom hovertext

```js
<LogoLinked animateRotate sizeSm="50px" title="I'm a custom title" sizeMd="60px" />
```
5 changes: 0 additions & 5 deletions src/components/Molecules/Logos/Logos.md

This file was deleted.

4 changes: 2 additions & 2 deletions src/components/Organisms/Header/Header.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';

import Logos from '../../Molecules/Logos/Logos';
import LogoLinked from '../../Molecules/LogoLinked/LogoLinked';
import MainNav from './Nav/Nav';
import {
Brand, HeaderWrapper, InnerWrapper, MetaIcons
Expand All @@ -13,7 +13,7 @@ const Header = ({
<HeaderWrapper navItems {...rest}>
<InnerWrapper>
<Brand>
<Logos campaign={campaign} />
<LogoLinked campaign={campaign} />
</Brand>
<MainNav navItems={navItems} />
<MetaIcons>{metaIcons}</MetaIcons>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Organisms/Header2025/Header2025.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';

import Logos from '../../Molecules/Logos/Logos';
import LogoLinked from '../../Molecules/LogoLinked/LogoLinked';
import HeaderNav2025 from './HeaderNav2025/HeaderNav2025';
import {
Brand, Header2025Wrapper, InnerWrapper,
Expand All @@ -15,7 +15,7 @@ const Header2025 = ({
<Header2025Wrapper navItems showBoxShadow={showBoxShadow} {...rest}>
<InnerWrapper>
<Brand>
<Logos
<LogoLinked
campaign={campaign}
sizeSm="50px"
sizeMd="55px"
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export { default as Chip } from './components/Molecules/Chip/Chip';
export { default as Descriptor } from './components/Molecules/Descriptor/Descriptor';
export { default as Lookup } from './components/Molecules/Lookup/Lookup';
export { default as SimpleSchoolLookup } from './components/Molecules/SimpleSchoolLookup/SimpleSchoolLookup';
export { default as LogoLinked } from './components/Molecules/LogoLinked/LogoLinked';

/* Organisms */
export {
Expand Down

0 comments on commit f6aa54b

Please sign in to comment.