-
Notifications
You must be signed in to change notification settings - Fork 61
fix: migrate buttondialpad #786
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,87 +1,34 @@ | ||
| .md-button-dialpad-wrapper { | ||
| border: var(--md-globals-border-clear); | ||
| cursor: pointer; | ||
| outline: none !important; | ||
| transition: background-color 0.2s, color 0.2s, border-color 0.2s; | ||
| background-color: var(--mds-color-theme-button-secondary-normal); | ||
|
|
||
| &:hover { | ||
| background-color: var(--mds-color-theme-button-secondary-hover); | ||
| } | ||
|
|
||
| &:active { | ||
| background-color: var(--mds-color-theme-button-secondary-pressed); | ||
| } | ||
|
|
||
| > * { | ||
| align-items: center; | ||
| display: flex; | ||
| height: 1em; | ||
| justify-content: center; | ||
| } | ||
|
|
||
| > .md-button-dialpad-primary-text { | ||
| color: var(--mds-color-theme-text-primary-normal); | ||
| } | ||
|
|
||
| > .md-button-dialpad-secondary-text { | ||
| color: var(--mds-color-theme-text-secondary-normal); | ||
| margin-top: 0.2em; | ||
| } | ||
|
|
||
| &[data-disabled='true'] { | ||
| background-color: var(--mds-color-theme-button-secondary-normal); | ||
| color: var(--mds-color-theme-text-primary-normal); | ||
| cursor: auto; | ||
|
|
||
| > .md-button-dialpad-primary-text { | ||
| color: var(--mds-color-theme-text-primary-normal); | ||
| } | ||
|
|
||
| > .md-button-dialpad-secondary-text { | ||
| color: var(--mds-color-theme-text-secondary-normal); | ||
| } | ||
|
|
||
| &:hover { | ||
| background-color: var(--mds-color-theme-button-secondary-normal); | ||
| } | ||
|
|
||
| &:active { | ||
| background-color: var(--mds-color-theme-button-secondary-normal); | ||
| } | ||
| } | ||
|
|
||
| /* Sizing and spacing. */ | ||
| align-items: center; | ||
| border-radius: 100vh; | ||
| display: flex; | ||
| flex-direction: column; | ||
| flex-shrink: 0; | ||
| justify-content: center; | ||
| height: 4rem; | ||
| width: 4rem; | ||
|
|
||
| &[data-size='64'] { | ||
| height: 4rem; | ||
| width: 4rem; | ||
| > .md-button-dialpad-inner-wrapper { | ||
| height: 100%; | ||
| width: 100%; | ||
| display: flex; | ||
| flex-direction: column; | ||
| justify-content: center; | ||
|
|
||
| > .md-button-dialpad-primary-text { | ||
| font-size: 1.625rem; | ||
| color: var(--mds-color-theme-text-primary-normal); | ||
| } | ||
|
|
||
| > .md-button-dialpad-secondary-text { | ||
| font-size: 0.75rem; | ||
| } | ||
| } | ||
|
|
||
| &[data-size='52'] { | ||
| height: 3.25rem; | ||
| width: 3.25rem; | ||
|
|
||
| > .md-button-dialpad-primary-text { | ||
| font-size: 1.25rem; | ||
| color: var(--mds-color-theme-text-secondary-normal); | ||
| margin-top: 0.2em; | ||
| height: 1em; | ||
| } | ||
|
|
||
| > .md-button-dialpad-secondary-text { | ||
| font-size: 0.75rem; | ||
| > * { | ||
| align-items: center; | ||
| display: flex; | ||
| height: 1em; | ||
| justify-content: center; | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,28 +1,31 @@ | ||
| import React, { forwardRef, RefObject } from 'react'; | ||
| import ButtonSimple from '../ButtonSimple'; | ||
| import { Button as MdcButton } from '@momentum-design/components/dist/react'; | ||
|
|
||
| import { DEFAULTS, STYLE } from './ButtonDialpad.constants'; | ||
| import { Props } from './ButtonDialpad.types'; | ||
| import { STYLE } from './ButtonDialpad.constants'; | ||
| import './ButtonDialpad.style.scss'; | ||
| import classnames from 'classnames'; | ||
|
|
||
| const ButtonDialpad = forwardRef((props: Props, providedRef: RefObject<HTMLButtonElement>) => { | ||
| const { className, disabled, size, ...otherProps } = props; | ||
| import type { Button } from '@momentum-design/components'; | ||
| import type { Props } from './ButtonDialpad.types'; | ||
|
|
||
| const children = props.children || props.primaryText; | ||
| const ButtonDialpad = forwardRef((props: Props, providedRef: RefObject<Button>) => { | ||
| const { className, ...otherProps } = props; | ||
|
|
||
| return ( | ||
| <ButtonSimple | ||
| <MdcButton | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the disabled button doesn't really look disabled but i guess it was that way before so its fine as is |
||
| className={classnames(STYLE.wrapper, className)} | ||
| ref={providedRef} | ||
| data-size={size || DEFAULTS.SIZE} | ||
| data-disabled={disabled || DEFAULTS.DISABLED} | ||
| isDisabled={disabled} | ||
| {...otherProps} | ||
| // size 40 is maximum size for MdcButton, setting it here and overriding | ||
| // size in scss file to 64px | ||
| size={40} | ||
| variant="tertiary" | ||
| {...(otherProps as any)} | ||
|
||
| > | ||
| <div className={STYLE.primaryText}>{children}</div> | ||
| <div className={STYLE.secondaryText}>{props.secondaryText}</div> | ||
| </ButtonSimple> | ||
| <div className={STYLE.innerWrapper}> | ||
| <div className={STYLE.primaryText}>{props.primaryText}</div> | ||
| <div className={STYLE.secondaryText}>{props.secondaryText}</div> | ||
| </div> | ||
| </MdcButton> | ||
| ); | ||
| }); | ||
|
|
||
|
|
||
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.
The default SIZE and SIZE constants can also be removed as they are no longer needed
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.
the default for DISABLED is only used in a test so can be removed as well