Skip to content

Commit a87c111

Browse files
authored
feat: use PluginSlot to add your site logo to studio footer (#520)
1 parent 655d6c0 commit a87c111

File tree

7 files changed

+78
-1225
lines changed

7 files changed

+78
-1225
lines changed

package-lock.json

Lines changed: 1 addition & 1216 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
"@edx/frontend-platform": "^8.2.1",
3636
"@edx/reactifex": "^2.1.1",
3737
"@openedx/frontend-build": "^14.3.1",
38-
"@openedx/frontend-plugin-framework": "^1.5.0",
3938
"@openedx/paragon": "^23.3.0",
4039
"@testing-library/jest-dom": "^5.16.4",
4140
"@testing-library/react": "^16.2.0",
@@ -56,6 +55,7 @@
5655
"@fortawesome/free-regular-svg-icons": "6.7.2",
5756
"@fortawesome/free-solid-svg-icons": "6.7.2",
5857
"@fortawesome/react-fontawesome": "0.2.2",
58+
"@openedx/frontend-plugin-framework": "^1.5.0",
5959
"classnames": "^2.5.1",
6060
"jest-environment-jsdom": "^29.7.0",
6161
"lodash": "^4.17.21",

src/components/studio-footer/StudioFooter.jsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ import {
88
Button,
99
Container,
1010
Hyperlink,
11-
Image,
1211
TransitionReplace,
1312
} from '@openedx/paragon';
1413
import { ExpandLess, ExpandMore, Help } from '@openedx/paragon/icons';
1514
import classNames from 'classnames';
1615
import PropTypes from 'prop-types';
1716

1817
import messages from './messages';
18+
import StudioFooterLogoSlot from '../../plugin-slots/StudioFooterLogoSlot';
1919

2020
ensureConfig([
2121
'LMS_BASE_URL',
@@ -134,13 +134,7 @@ const StudioFooter = ({
134134
<FormattedMessage {...messages.trademarkMessage} />
135135
<Hyperlink className="ml-1" destination="https://www.edx.org">edX Inc</Hyperlink>.
136136
<ActionRow.Spacer />
137-
<Hyperlink destination="https://openedx.org" className="float-right">
138-
<Image
139-
width="120px"
140-
alt="Powered by Open edX"
141-
src="https://logos.openedx.org/open-edx-logo-tag.png"
142-
/>
143-
</Hyperlink>
137+
<StudioFooterLogoSlot />
144138
</ActionRow>
145139
</Container>
146140
</>

src/plugin-slots/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# `frontend-component-footer` Plugin Slots
2+
3+
* [`studio_footer_logo_slot`](./StudioFooterLogoSlot/)
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# StudioFooterLogo Slot
2+
3+
### Slot ID: `studio_footer_logo_slot`
4+
5+
## Description
6+
7+
This slot is used to add your site logo to the studio footer.
8+
9+
## Examples
10+
11+
### Add your site logo.
12+
13+
The following `env.config.jsx` will add your site logo to the studio footer.
14+
15+
![Screenshot of modified Studio Footer Logo](./images/add_your_site_logo.png)
16+
17+
```jsx
18+
import { PLUGIN_OPERATIONS, DIRECT_PLUGIN } from '@openedx/frontend-plugin-framework';
19+
import {
20+
Hyperlink,
21+
Image,
22+
} from '@openedx/paragon';
23+
24+
const config = {
25+
pluginSlots: {
26+
studio_footer_logo_slot: {
27+
keepDefault: true,
28+
plugins: [
29+
{
30+
op: PLUGIN_OPERATIONS.Insert,
31+
widget: {
32+
id: 'studio_footer_logo_slot',
33+
type: DIRECT_PLUGIN,
34+
priority: 40,
35+
RenderWidget: () => {
36+
return (
37+
<Hyperlink destination="https://example.com/" className="float-right">
38+
<Image
39+
height="48px"
40+
alt="Hosted by MySite"
41+
src="https://logos.openedx.org/generic-logo.svg"
42+
/>
43+
</Hyperlink>
44+
)
45+
}
46+
}
47+
},
48+
],
49+
}
50+
},
51+
};
52+
53+
export default config;
54+
```
285 KB
Loading
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react';
2+
import { PluginSlot } from '@openedx/frontend-plugin-framework';
3+
import { Hyperlink, Image } from '@openedx/paragon';
4+
5+
const StudioFooterLogoSlot = () => (
6+
<PluginSlot id="studio_footer_logo_slot">
7+
<Hyperlink destination="https://openedx.org" className="float-right">
8+
<Image
9+
width="120px"
10+
alt="Powered by Open edX"
11+
src="https://logos.openedx.org/open-edx-logo-tag.png"
12+
/>
13+
</Hyperlink>
14+
</PluginSlot>
15+
);
16+
17+
export default StudioFooterLogoSlot;

0 commit comments

Comments
 (0)