-
Notifications
You must be signed in to change notification settings - Fork 5
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
Expose As Is - PageHeader, LinkElement Prop & Logo #1184
Changes from all commits
270199f
7d33129
96dfb4a
06b3a01
947ad47
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React, { ComponentType } from 'react'; | ||
import { Tip } from '../tip'; | ||
import { LinkProperties } from '../card'; | ||
import { Brand, PageTitleSecLink } from './logo'; | ||
/** | ||
* LogoContainer that is meant to integrate in the default page header without the dependencies of the veda virtual modules | ||
* and expects the Logo SVG to be passed in as a prop - this will support the instance for refactor | ||
*/ | ||
|
||
export default function LogoContainer ({ linkProperties, Logo, title, subTitle, version }: { | ||
linkProperties: LinkProperties, | ||
Logo: JSX.Element, | ||
title: string, | ||
subTitle: string, | ||
version: string | ||
}) { | ||
const LinkElement: ComponentType<any> = linkProperties.LinkElement as ComponentType<any>; | ||
|
||
return ( | ||
<Brand> | ||
<LinkElement {...{[linkProperties.pathAttributeKeyName]: '/'}}> | ||
{Logo} | ||
<span>{title}</span> <span>{subTitle}</span> | ||
</LinkElement> | ||
<Tip content={`v${version}`}> | ||
<PageTitleSecLink {...{as: linkProperties.LinkElement as ComponentType<any>, [linkProperties.pathAttributeKeyName]: '/development'}}>Beta</PageTitleSecLink> | ||
</Tip> | ||
</Brand> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import React from 'react'; | ||
import React, { ComponentType } from 'react'; | ||
import styled from 'styled-components'; | ||
import { glsp, media, themeVal } from '@devseed-ui/theme-provider'; | ||
import { Link } from 'react-router-dom'; | ||
import NasaLogo from '../nasa-logo'; | ||
import { Tip } from '../tip'; | ||
import { LinkProperties } from '../card'; | ||
import { ComponentOverride } from '$components/common/page-overrides'; | ||
|
||
const appTitle = process.env.APP_TITLE; | ||
const appVersion = process.env.APP_VERSION; | ||
|
||
const Brand = styled.div` | ||
export const Brand = styled.div` | ||
display: flex; | ||
flex-shrink: 0; | ||
|
||
|
@@ -74,7 +74,7 @@ const Brand = styled.div` | |
} | ||
`; | ||
|
||
const PageTitleSecLink = styled(Link)` | ||
export const PageTitleSecLink = styled.a` | ||
align-self: end; | ||
font-size: 0.75rem; | ||
font-weight: ${themeVal('type.base.bold')}; | ||
|
@@ -98,16 +98,18 @@ const PageTitleSecLink = styled(Link)` | |
`} | ||
`; | ||
|
||
export default function Logo () { | ||
export default function Logo ({ linkProperties }: { linkProperties: LinkProperties }) { | ||
const LinkElement: ComponentType<any> = linkProperties.LinkElement as ComponentType<any>; | ||
|
||
return ( | ||
<ComponentOverride with='headerBrand'> | ||
<Brand> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am having trouble understanding how exporting Logo can work, when There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All of the instsances except OG dashboard overrides this component with each instance's branding : ex. https://github.com/US-GHG-Center/veda-config-ghg/blob/16fe5b7c08e67f78e1a2a27727a82ff28034f4bc/overrides/components/header-brand/component.tsx#L4 🤔 which makes me wonder if this component is worth exporting at all. how do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably not worth exporting, and we could anyway pass any ReactElement as a logo prop from Next.js: https://github.com/NASA-IMPACT/veda-ui/pull/1184/files#diff-86e372214b3b1dff36fcabf602d3ea911690d226a6e0bed48fee30b571864756R233 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. very good point, thanks for making it 👍🏼 It might make sense in this case to separate the actual logo/svg from the styled container and have the logo/svg passed as a prop. I'll have to remove the veda virtual module dependency though so might have to recreate the same without the override 🤔, let me give it more thought! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created a separate LogoContainer component that takes in the SVG logo as a prop along with other attributres like title. When working on the new page header design implementation, we might not have to expose this container though as its meant to just fit in the page header itself, might just have instance pass in only the SVG itself but this will work best for now for our current state of code. |
||
<Link to='/'> | ||
<LinkElement {...{[linkProperties.pathAttributeKeyName]: '/'}}> | ||
<NasaLogo /> | ||
<span>Earthdata</span> <span>{appTitle}</span> | ||
</Link> | ||
</LinkElement> | ||
<Tip content={`v${appVersion}`}> | ||
<PageTitleSecLink to='/development'>Beta</PageTitleSecLink> | ||
<PageTitleSecLink {...{as: linkProperties.LinkElement as ComponentType<any>, [linkProperties.pathAttributeKeyName]: '/development'}}>Beta</PageTitleSecLink> | ||
</Tip> | ||
</Brand> | ||
</ComponentOverride>); | ||
|
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 am not sure if this component can be used by other instances when only logo svg is tweak-able - (ex. ghg overwrote the whole logo)
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.
The plan is to use the logo container in the larger page-header component. So i mentioned in my above comment we probably dont have to expose this actually because it would just be integrated in page-header component directly but this would come in the next iteration of implementing the new page-header design. So its more like a set up for next phase 👍🏼