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

Migrate tooltip to ts #4524

Closed
wants to merge 1 commit into from
Closed

Migrate tooltip to ts #4524

wants to merge 1 commit into from

Conversation

ngprnk
Copy link

@ngprnk ngprnk commented Apr 23, 2020

Description

Related issue #4314
Migrated tooltip component to typescript

Changelog

  • CHANGELOG.md is updated with user-facing content relevant to this PR.

Affected components

  • Server
  • Console
  • CLI
  • Docs
  • Community Content
  • Build System
  • Tests
  • Other (list it)

Related Issues

Catalog upgrade

Does this PR change Hasura Catalog version?

  • No
  • Yes
    • Updated docs with SQL for downgrading the catalog

Metadata

Does this PR add a new Metadata feature?

  • No
  • Yes
    • Does run_sql auto manages the new metadata through schema diffing?
      • Yes
      • Not required
    • Does run_sql auto manages the definitions of metadata on renaming?
      • Yes
      • Not required
    • Does export_metadata/replace_metadata supports the new metadata added?
      • Yes
      • Not required

GraphQL

  • No new GraphQL schema is generated
  • New GraphQL schema is being generated:
    • New types and typenames are correlated

Breaking changes

  • No Breaking changes
  • There are breaking changes:

@ngprnk ngprnk requested a review from a team as a code owner April 23, 2020 08:49
@hasura-bot
Copy link
Contributor

Beep boop! 🤖

Hey @ngprnk, thanks for your PR!

One of my human friends will review this PR and get back to you as soon as possible.

Stay awesome! 😎

@CLAassistant
Copy link

CLAassistant commented Apr 23, 2020

CLA assistant check
All committers have signed the CLA.

@netlify
Copy link

netlify bot commented Apr 23, 2020

Deploy preview for hasura-docs ready!

Built with commit 47605d4

https://deploy-preview-4524--hasura-docs.netlify.app

@beerose beerose self-assigned this Apr 23, 2020
Copy link
Contributor

@beerose beerose left a comment

Choose a reason for hiding this comment

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

Thank you for your PR! 🎉

Left some comments.


export type ToolTipProps = {
message: ToolTypeGeneratorProps;
placement: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we narrow this type?

Suggested change
placement: string;
placement: 'top' | 'right' | 'bottom' | 'left';

export type ToolTipProps = {
message: ToolTypeGeneratorProps;
placement: string;
children: any;
Copy link
Contributor

Choose a reason for hiding this comment

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

If you're using React.FC typings for children are already there.

Suggested change
children: any;

message: string;
};

export const tooltipGenerator: React.FC<ToolTypeGeneratorProps> = ({
Copy link
Contributor

Choose a reason for hiding this comment

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

tooltipGenerator was a function from string to JSX.Element. Could you revert this change?

};

export type ToolTipProps = {
message: ToolTypeGeneratorProps;
Copy link
Contributor

Choose a reason for hiding this comment

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

We want to pass message as a string.

Suggested change
message: ToolTypeGeneratorProps;
message: string;

@@ -4,6 +4,5 @@ import { space } from 'styled-system';
export const StyledTooltip = styled.span`
display: inline-block;
position: relative;

${space}
Copy link
Contributor

Choose a reason for hiding this comment

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

We should provide typings for StyledTooltip which are:

  • SpaceProps (imported from styled-system)
  • HTML span element attributes
import styled from 'styled-components';
import { space, SpaceProps } from 'styled-system';

export interface StyledTooltipProps
  extends SpaceProps,
    React.ComponentPropsWithRef<'span'> {}

export const StyledTooltip = styled.span<SpaceProps>`
  display: inline-block;
  position: relative;

  ${space}
`;

return <Tooltip id={message}>{message}</Tooltip>;
};

export type ToolTipProps = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use interface that extends StyledTooltipProps.
export interface ToolTipProps extends StyledTooltipProps { ... }

@beerose
Copy link
Contributor

beerose commented Jun 24, 2021

Closing this PR due to lack of activity

@beerose beerose closed this Jun 24, 2021
@hasura-bot
Copy link
Contributor

Beep boop! 🤖

Hey @ngprnk!

Sorry that your PR wasn’t merged.

Do take a look at any of the other open issues to see if you’d like to take something up! We’re around on Discord if you have any questions 😄

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.

4 participants