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(core): export gosling svg logo #1038

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

sehilyi
Copy link
Member

@sehilyi sehilyi commented Feb 7, 2024

Can we include the SVG element of the Gosling logo image in the gosling.js library? This would make it easier for people to add a Gosling logo to their applications (e.g., "Powered by" labels). Helpful for some of our applications in the lab as well since we do not need to copy and paste the SVG code.

import react from 'React';
import * gosling from 'gosling.js';

return (
   ...
   {gosling.getGoslingLogoSVG(20, 20)}
)

Change List

Checklist

  • Ensure the PR works with all demos on the online editor
  • Unit tests added or updated
  • Examples added or updated
  • Documentation updated (e.g., added API functions)
  • Screenshots for visual changes (e.g., new encoding support or UI change on Editor)

@sehilyi sehilyi changed the title feat: export gosling svg logo feat(core): export gosling svg logo Feb 7, 2024
@sehilyi sehilyi requested a review from manzt February 7, 2024 13:31
Copy link
Member

@manzt manzt left a comment

Choose a reason for hiding this comment

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

Some minor comments. I'd export this function (and use it) as a React Component.

@@ -0,0 +1,31 @@
import React from 'react';

export const getGoslingLogoSvg = (width = 20, height = 20) => (
Copy link
Member

@manzt manzt Feb 7, 2024

Choose a reason for hiding this comment

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

This function returns JSX, so it requires React to use it (i.e., it is a React component). Rather than getGoslingLogoSvg why not export GoslingLogo component:

type GoslingLogoProps = {
  width: number;
  height: number;
}

export function GoslingLogo({ width = 20, height = 20 }: GoslingLogoProps) {
  return <svg>...</svg>
}

I'd also include some JSDoc comments for GoslingLogoProps to explain what width and height are (pixels, fractional units, etc).

Copy link
Member

Choose a reason for hiding this comment

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

If width and height should always be then same, then I'd go for just size.

Copy link
Member

Choose a reason for hiding this comment

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

import react from 'React';
import { GoslingLogo } from 'gosling.js';

function App() {
  return <GoslingLogo size={20} />
}

@manzt
Copy link
Member

manzt commented Feb 7, 2024

Another option would be to have a button in the Gosling editor /website to copy the icon in different ways (svg "raw", or JSX):

image

https://lucide.dev/icons/align-horizontal-distribute-end

I personally like this option because you can copy the SVG directly into your project and style it however you like (with or without react). With the React component, you define how styling needs to happen.

@sehilyi
Copy link
Member Author

sehilyi commented Feb 7, 2024

Ah, I like the idea of adding a button to copy the logo! I am now leaning toward adding that to the editor or probably our website.

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.

2 participants