Skip to content

Commit

Permalink
Support no_footer option
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Hananein authored and umputun committed Oct 26, 2022
1 parent 2bdc05d commit 984fbde
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
20 changes: 13 additions & 7 deletions frontend/apps/remark42/app/components/root/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -351,22 +351,28 @@ const CopyrightLink = (title: string) => (
</a>
);

const Copyright = () => (
<p className="root__copyright" role="contentinfo">
<FormattedMessage id="root.powered-by" defaultMessage="Powered by <a>Remark42</a>" values={{ a: CopyrightLink }} />
</p>
);

/** Root component connected to redux */
export function ConnectedRoot() {
const intl = useIntl();
const props = useSelector(mapStateToProps);
const actions = useActions(boundActions);

if (!window.remark_config) {
throw new Error('Remark42: Config object is undefined');
}

const { no_footer } = window.remark_config;

return (
<div className={clsx(b('root', {}, { theme: props.theme }), props.theme)}>
<Root {...props} {...actions} intl={intl} />
<p className="root__copyright" role="contentinfo">
<FormattedMessage
id="root.powered-by"
defaultMessage="Powered by <a>Remark42</a>"
values={{ a: CopyrightLink }}
/>
</p>
{!no_footer && <Copyright />}
</div>
);
}
1 change: 1 addition & 0 deletions frontend/apps/remark42/app/typings/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type RemarkConfig = {
max_last_comments?: number;
__colors__?: Record<string, string>;
simple_view?: boolean;
no_footer?: boolean;
};

declare global {
Expand Down
4 changes: 3 additions & 1 deletion site/src/docs/configuration/frontend/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ title: Frontend Configuration
- **`show_email_subscription`**`: boolean` (optional, `true` by default) – enables email subscription feature in interface when enable it from backend side, if you set this param in `false` you will get notifications email notifications as admin but your users won't have interface for subscription
- **`show_rss_subscription`**`: boolean` (optional, `true` by default) – enables RSS subscription feature in interface
- **`simple_view`**`: boolean` (optional, `false` by default) – overrides the parameter from the backend minimized UI with basic info only
- **`no_footer`**`: boolean` (optional, `false` by default) – hides footer with signatue and links to remark42

Example with all of the params:

Expand All @@ -34,7 +35,8 @@ Example with all of the params:
page_title: 'My custom title for a page',
locale: 'es',
show_email_subscription: false,
simple_view: true
simple_view: true,
no_footer: false
}
</script>
```
Expand Down

0 comments on commit 984fbde

Please sign in to comment.