Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

Commit

Permalink
feat: ✨ show RSS feed icon in header
Browse files Browse the repository at this point in the history
  • Loading branch information
filipowm committed Jul 3, 2020
1 parent 6349bb4 commit e939b34
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ module.exports = {
},
rss: {
enabled: true,
showIcon: true,
copyright: '2020, Mateusz Filipowicz',
webMaster: 'Mateusz Filipowicz (matfilipowicz@gmail.com)',
managingEditor: 'Mateusz Filipowicz (matfilipowicz@gmail.com)',
Expand Down
10 changes: 10 additions & 0 deletions src/components/Header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ButtonIcon, DarkModeSwitch, SearchInput, Sidebar } from '../';
import { HelpCircle, Search } from 'react-feather';
import { useTheme } from 'emotion-theming';
import SocialButtons from './social';
import { Rss } from '../Buttons'

const SearchIcon = styled(Search)`
width: 1.2em;
Expand Down Expand Up @@ -142,6 +143,13 @@ const HelpButton = ({ helpUrl, ...props }) => {
);
};

const RssIcon = (iconBaseProps) => {
if (config.features.rss && config.features.rss.enabled && config.features.rss.showIcon) {
return <Rss {...iconBaseProps} link={config.features.rss.outputPath} title={'RSS feed'}/>
}
return null;
}

const Header = ({ setShowSearch, location, themeProvider }) => (
<StaticQuery
query={graphql`
Expand Down Expand Up @@ -203,9 +211,11 @@ const Header = ({ setShowSearch, location, themeProvider }) => (
{isSearchEnabled ? <SearchOpener open={open} /> : null}
{helpUrl && helpUrl.length > 0 ? <HelpButton helpUrl={helpUrl} /> : ''}
{ SocialButtons(iconBaseProps, config.social) }
<RssIcon {...iconBaseProps}/>
{config.features.darkMode.enabled ? (
<DarkModeSwitch
{...iconBaseProps}
style={{marginLeft: '10px'}}
hoverFill={theme.header.icons.hover}
fill={theme.header.icons.fill}
isDarkThemeActive={darkMode}
Expand Down

0 comments on commit e939b34

Please sign in to comment.