-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dagster-io/ui] Eliminate RR dependency (#7285)
- Loading branch information
Showing
23 changed files
with
235 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
...i/src/components/AnchorButton.stories.tsx → ...ages/core/src/ui/AnchorButton.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// eslint-disable-next-line no-restricted-imports | ||
import {AnchorButton as BlueprintAnchorButton} from '@blueprintjs/core'; | ||
import { | ||
intentToFillColor, | ||
intentToStrokeColor, | ||
intentToTextColor, | ||
StyledButton, | ||
StyledButtonText, | ||
} from '@dagster-io/ui'; | ||
import * as React from 'react'; | ||
import {Link, LinkProps} from 'react-router-dom'; | ||
|
||
interface AnchorButtonProps | ||
extends Omit<React.ComponentProps<typeof BlueprintAnchorButton>, 'loading' | 'onClick' | 'type'>, | ||
LinkProps { | ||
label?: React.ReactNode; | ||
} | ||
|
||
export const AnchorButton = React.forwardRef( | ||
(props: AnchorButtonProps, ref: React.ForwardedRef<HTMLAnchorElement>) => { | ||
const {children, icon, intent, outlined, rightIcon, ...rest} = props; | ||
return ( | ||
<StyledButton | ||
{...rest} | ||
as={Link} | ||
$fillColor={intentToFillColor(intent, outlined)} | ||
$strokeColor={intentToStrokeColor(intent, outlined)} | ||
$textColor={intentToTextColor(intent, outlined)} | ||
ref={ref} | ||
> | ||
{icon || null} | ||
{children ? <StyledButtonText>{children}</StyledButtonText> : null} | ||
{rightIcon || null} | ||
</StyledButton> | ||
); | ||
}, | ||
); | ||
|
||
AnchorButton.displayName = 'AnchorButton'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,63 @@ | ||
// todo dish: Move implementation from `ui` | ||
// eslint-disable-next-line no-restricted-imports | ||
import {MenuItem} from '@blueprintjs/core'; | ||
import {Box, ColorsWIP, CommonMenuItemProps, IconWrapper, iconWithColor} from '@dagster-io/ui'; | ||
import * as React from 'react'; | ||
import {Link, LinkProps} from 'react-router-dom'; | ||
import styled from 'styled-components/macro'; | ||
|
||
export {MenuLink} from '@dagster-io/ui'; | ||
interface MenuLinkProps | ||
extends CommonMenuItemProps, | ||
Omit<React.ComponentProps<typeof MenuItem>, 'icon' | 'onClick'>, | ||
LinkProps {} | ||
|
||
/** | ||
* If you want to use a menu item as a link, use `MenuLink` and provide a `to` prop. | ||
*/ | ||
export const MenuLink: React.FC<MenuLinkProps> = (props) => { | ||
const {icon, intent, text, ...rest} = props; | ||
|
||
return ( | ||
<StyledMenuLink {...rest}> | ||
<Box flex={{direction: 'row', gap: 8, alignItems: 'center'}}> | ||
{iconWithColor(icon, intent)} | ||
<div>{text}</div> | ||
</Box> | ||
</StyledMenuLink> | ||
); | ||
}; | ||
|
||
const StyledMenuLink = styled(Link)` | ||
text-decoration: none; | ||
border-radius: 4px; | ||
display: block; | ||
line-height: 20px; | ||
padding: 6px 8px 6px 12px; | ||
transition: background-color 50ms, box-shadow 150ms; | ||
align-items: flex-start; | ||
user-select: none; | ||
/** | ||
* Use margin instead of align-items: center because the contents of the menu item may wrap | ||
* in unusual circumstances. | ||
*/ | ||
${IconWrapper} { | ||
margin-top: 2px; | ||
} | ||
${IconWrapper}:first-child { | ||
margin-left: -4px; | ||
} | ||
&&&:link, | ||
&&&:visited, | ||
&&&:hover, | ||
&&&:active { | ||
color: ${ColorsWIP.Gray900}; | ||
text-decoration: none; | ||
} | ||
&&&:hover { | ||
background: ${ColorsWIP.Gray100}; | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import {TabStyleProps, getTabA11yProps, getTabContent, tabCSS} from '@dagster-io/ui'; | ||
import * as React from 'react'; | ||
import {Link, LinkProps} from 'react-router-dom'; | ||
import styled from 'styled-components/macro'; | ||
|
||
interface TabLinkProps extends TabStyleProps, Omit<LinkProps, 'title'> { | ||
title?: React.ReactNode; | ||
} | ||
|
||
export const TabLink = styled((props: TabLinkProps) => { | ||
const {to, title, ...rest} = props; | ||
const containerProps = getTabA11yProps(props); | ||
const content = getTabContent(props); | ||
|
||
const titleText = typeof title === 'string' ? title : undefined; | ||
|
||
return ( | ||
<Link to={to} title={titleText} {...containerProps} {...rest}> | ||
{content} | ||
</Link> | ||
); | ||
})<TabLinkProps>` | ||
${tabCSS} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
36b189f
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.
Successfully deployed to the following URLs:
dagit-storybook – ./js_modules/dagit/packages/ui
dagit-storybook.vercel.app
dagit-storybook-elementl.vercel.app
dagit-storybook-git-master-elementl.vercel.app