-
Notifications
You must be signed in to change notification settings - Fork 70
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
BrandLogo Component #46
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove gitpod.yml
It should not be ommitted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of hacking this into the Navbar, how about creating a totally independent navbarlogo
React component that is optionally composable into Navbar, in any position, and for ANY logo and branding.
Be sure to take advantage of NextJS packing and lazy loading when crafting component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create new component
Great Idea, I will create a new component . |
@Sing-Li Can you look into this ? I read the docs regarding NextJS packing and lazy loading , I can incorporate the feature to only load the logo image when its viewed to increase efficiency but I don't think this would be much useful for this particular component as the navbar will always be loaded first and so will the brand logo. We can surely utilize lazy loading with some of the larger graphics components which are shown as we scroll further down. Let me know if I am thinking in the right direction :) |
@@ -1,16 +1,20 @@ | |||
import { useState } from 'react'; | |||
import { Navbar, Nav, NavDropdown, Container, Col, Row } from 'react-bootstrap'; | |||
import styles from '../styles/Menubar.module.css'; | |||
import BrandLogo from './brandlogo'; | |||
|
|||
export default function Menubar(props) { | |||
const [collapsed, setCollapsed] = useState(true); | |||
|
|||
return ( | |||
<Container fluid class='border-bottom '> | |||
<Navbar expand='lg' className=' bg-white mx-4 my-2'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please lint your code.
.brand { | ||
font-size: clamp(16px, 2.4vw, 20px); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove extra lines (lint your code)
app/components/menubar.js
Outdated
<BrandLogo | ||
brandLink={'#home'} | ||
logoLink={'https://global-uploads.webflow.com/611a19b9853b7414a0f6b3f6/611bbb87319adfd903b90f24_logoRC.svg'} | ||
imageTitle={'Rocket.chat'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rocket.Chat
@samad-yar-khan please also squash your commits into one. |
fac0347
to
2061afd
Compare
@RonLek Sir, I have linted my code squashed the commits into one. |
I've made comment in-line. When designing a NextJS component - you need to anticipate when and where it will be used. For example, some Community Builder may have complex logo image/svg that takes minutes to render and the rest of the page where the component is used may have hundreds of other images/svgs to load. You are thinking too narrowly focused on ONLY THIS use-case with our Rocket.Chat logo/branding (and only as part of the navbar). |
app/components/brandlogo.js
Outdated
export default function BrandLogo(props) { | ||
return ( | ||
<Navbar.Brand href={props.brandLink} className={styles.brand}> | ||
<img |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using the Image
component from NextJS.
1fbab1b
to
4efd378
Compare
@Sing-Li I have made the BrandLogo component lazy loading such that, the logo is only fetched and displayed when we scroll over the component. I have used the following package : https://www.npmjs.com/package/react-cool-inview. Let me if there are any changes. |
app/components/brandlogo.js
Outdated
@@ -0,0 +1,28 @@ | |||
import dynamic from "next/dynamic"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not use dynamic or inview. These are pure unnecessary baggages.
Just using <Image>
will get you all the benefits as stated in its docs. Please read the doc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand, I will remove dynamic and inview and use the properties of <Image>
for optimisation
4efd378
to
ce6f80e
Compare
@Sing-Li I have removed the unnecessary code. and packages I went through the documentation and figured that by default the |
@samad-yar-khan i was trying to remove the warnings in the console, there was this warning which is due to brandlogo component can you please look into it |
Proposed changes (including videos or screenshots)
Issue(s)
This current master branch did not have the image tag at all but this should fix the below issue aswell.
Fixes : #43
Steps to test or reproduce
Mentioned in the Issue
Before :
After :