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 possibility to add background color to the suite icon logo #241

Merged
merged 9 commits into from
May 22, 2024

Conversation

gabyzif
Copy link
Contributor

@gabyzif gabyzif commented May 21, 2024

This PR adds the possibility to add background color to the suite icon logo

image

story: here

src/components/navigation/GlobalNavigation/SuiteLogo.tsx Outdated Show resolved Hide resolved
Comment on lines +301 to +302
width: 36px;
height: 36px;
Copy link
Collaborator

Choose a reason for hiding this comment

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

question Should those be variables?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is old code, IMO it should be gone and replaced w the icon size of the icon component (see comment below)

Comment on lines 16 to 20
typeof props.icon !== 'string' ? (
props.icon
) : (
<Icon name={props.icon as keyof typeof Icons} color="brand" size="xxl" />
)
Copy link
Collaborator

@tibuurcio tibuurcio May 21, 2024

Choose a reason for hiding this comment

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

question I'm confused why do we need that? 🤔
Are we trying to support both a string and JSX is that it? That's for removing the Icon thing on mP's root page?

Can't see how this change is related to the PR description.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

correct. IMO we should move towards the string with the pre-set size of the icon and color (specially for consistency purposes, since this is only used in the navbar)... but I don't wanna break everything (now)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right now, we are setting the icon size in the css, but since we have the new size variables we can just use them :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

huh, if we do go this route, i suggest flipping the if statement, so the true condition comes first
if icon == string, <icon/>, else props.icon

@@ -50,7 +51,7 @@ export const GlobalNavigation = (props: IGlobalNavigationProps) => {
<Layout.Sider className="globalNavigation__sider" width={GlobalNavWidth}>
<Flex vertical justify="space-between" style={{ height: '100%' }}>
<div>
<SuiteLogo {...props.logo} />
{!props.hideSuiteLogo && <SuiteLogo {...props.logo} />}
<div className="globalNavigation__divider" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

suggestion: I think this divider should also be hidden if suite logo is not showing. it has bottom margin, that's why we have this odd spacing

@@ -295,6 +290,19 @@
cursor: pointer;
}

.globalNavigation__suiteLogo-background {
background-color: var(--mp-brand-primary-2);
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: hmmm, I'd prefer to see semantic names, but it's up to you (I'm not the CSS owner here 😝 )

Suggested change
background-color: var(--mp-brand-primary-2);
background-color: var(--color-primary-bg-hover);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2024-05-21 at 11 45 20 PM

jeje I used this variable to keep consistency w the icons :)

@@ -11,7 +12,8 @@ export interface IBaseGlobalNavigationItem {

export interface IGlobalNavigationLogo extends IBaseGlobalNavigationItem {
onSuiteLogoClick: () => void
type?: 'default' | 'background-solid'
type?: 'default' | 'background-solid' | 'custom-size'
icon?: ReactElement | keyof typeof Icons
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we not use ReactNode here? thats what we've been using for most types, do you [or Mr. A.I.] know the difference between the two?

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 changed it to ReactElement bc ReactNode accepts string and I want to enforce to write only the strings that are allowed in the icon component :)

Copy link
Collaborator

@nastyastavitskaya nastyastavitskaya left a comment

Choose a reason for hiding this comment

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

🥳 let's gooo

@gabyzif gabyzif merged commit d4c206a into feat/icons-integration May 22, 2024
10 of 12 checks passed
mparticle-automation added a commit that referenced this pull request May 22, 2024
# [1.15.0-icons-integration.2](v1.15.0-icons-integration.1...v1.15.0-icons-integration.2) (2024-05-22)

### Features

* add possibility to add background color to the suite icon logo ([#241](#241)) ([d4c206a](d4c206a))
@mparticle-automation
Copy link
Collaborator

🎉 This PR is included in version 1.15.0-icons-integration.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gabyzif gabyzif mentioned this pull request May 24, 2024
@gabyzif gabyzif deleted the feat/icons-suiteLogoBg branch August 13, 2024 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants