Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add frontend-plugin-framework LogoSlot #526

Closed

Conversation

brian-smith-tcril
Copy link
Contributor

No description provided.

@@ -60,6 +60,7 @@
"@fortawesome/free-regular-svg-icons": "6.6.0",
"@fortawesome/free-solid-svg-icons": "6.6.0",
"@fortawesome/react-fontawesome": "^0.2.0",
"@openedx/frontend-plugin-framework": "^1.2.3",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it makes more sense to have this as a direct dependency here or to make it a peer dependency. I went with direct but I'd like to hear what others think.

Comment on lines -4 to -11
const Logo = ({ src, alt, ...attributes }) => (
<img src={src} alt={alt} {...attributes} />
);

Logo.propTypes = {
src: PropTypes.string.isRequired,
alt: PropTypes.string.isRequired,
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I combed through the codebase and couldn't find any time where we are using a logo without a link. I have some previous commits on a WIP branch that add slots and don't remove this, but I figured I might as well take the opportunity to clean up unused code.

href,
src,
alt,
...attributes
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could only find 2 attributes being added to the logo throughout the codebase. One was className="logo", which was being done everywhere the logo was being used. I figured just being able to write <Logo instead of <Logo className="logo" made more sense, so I moved that down into the component itself.

The other attribute was less straightforward. In MobileHeader only the LinkedLogo had itemType="http://schema.org/Organization". It wasn't clear to me why that would only be in the mobile header. For now I just removed it, but I'd like to revisit this and come up with a better solution.

src/Logo.jsx Outdated
Comment on lines 10 to 16
Logo.propTypes = {
content: PropTypes.shape({
href: PropTypes.string.isRequired,
src: PropTypes.string.isRequired,
alt: PropTypes.string.isRequired,
})
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this as a workaround since React allows editing children of a prop that is an object but not props directly. I think this could be undone if openedx/frontend-plugin-framework#84 is merged.

Copy link

codecov bot commented Aug 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.47%. Comparing base (97d1bde) to head (daffed5).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #526      +/-   ##
==========================================
- Coverage   70.60%   70.47%   -0.14%     
==========================================
  Files          24       25       +1     
  Lines         364      359       -5     
  Branches       96       94       -2     
==========================================
- Hits          257      253       -4     
+ Misses        105      104       -1     
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant