Skip to content

Commit

Permalink
chore: Removes DeprecatedButton usage. (#49)
Browse files Browse the repository at this point in the history
* chore: Removes DeprecatedButton usage.

* chore: Bumps version of react package
  • Loading branch information
scottlovegrove committed Jan 13, 2023
1 parent 261d747 commit 0423f47
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 35 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/ui-extensions-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@doist/ui-extensions-react",
"version": "9.1.0",
"version": "9.2.0",
"author": "Doist",
"license": "MIT",
"main": "dist/index.js",
Expand Down
44 changes: 11 additions & 33 deletions packages/ui-extensions-react/src/renderers/action-renderers.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import ReactDOM from 'react-dom'

import { Button, ButtonProps, DeprecatedButton } from '@doist/reactist'
import { Button, ButtonProps } from '@doist/reactist'

import { ActionAlignment, ActionStyle, GlobalRegistry, OpenUrlAction } from 'adaptivecards'
import classNames from 'classnames'

import { ClipboardAction, SubmitActionist } from '../actions'
import { isDangerButton, isPrimaryButton } from '../utils'

import type { CSSProperties } from 'react'

type ActionProps = {
title: string
style: ActionStyle
baseCssClass?: string
id?: string
onClick?: ((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void) | undefined
isLink?: boolean
actionAlignment: ActionAlignment
isInputButton?: boolean
}
Expand All @@ -34,7 +31,6 @@ export function createActionDiv({
baseCssClass,
id,
onClick,
isLink,
actionAlignment,
isInputButton,
}: ActionProps): HTMLDivElement {
Expand All @@ -43,36 +39,18 @@ export function createActionDiv({
div.style.paddingLeft = '6px'
}

const linkStyle: CSSProperties = {
marginTop: '6px',
}

// eslint-disable-next-line import/no-named-as-default-member
ReactDOM.render(
isLink ? (
<DeprecatedButton
id={id}
onClick={onClick}
className={classNames(baseCssClass, {
'ac-action-stretch': actionAlignment === ActionAlignment.Stretch,
})}
variant="link"
style={linkStyle}
>
{title}
</DeprecatedButton>
) : (
<Button
{...getNewButtonProps(style)}
id={id}
onClick={onClick}
exceptionallySetClassName={classNames(baseCssClass, {
'ac-action-stretch': actionAlignment === ActionAlignment.Stretch,
})}
>
{title}
</Button>
),
<Button
{...getNewButtonProps(style)}
id={id}
onClick={onClick}
exceptionallySetClassName={classNames(baseCssClass, {
'ac-action-stretch': actionAlignment === ActionAlignment.Stretch,
})}
>
{title}
</Button>,
div,
)
return div
Expand Down

0 comments on commit 0423f47

Please sign in to comment.