From 39c2c8f8369cfa3f68dfee5e50b4c274718cc23a Mon Sep 17 00:00:00 2001 From: Sami Korpela Date: Tue, 5 Nov 2019 15:34:18 +0200 Subject: [PATCH 1/2] 'disabledCursor' css-util created --- src/components/utils/css.ts | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 src/components/utils/css.ts diff --git a/src/components/utils/css.ts b/src/components/utils/css.ts new file mode 100644 index 000000000..681f9936b --- /dev/null +++ b/src/components/utils/css.ts @@ -0,0 +1,5 @@ +import { css } from 'styled-components'; + +export const disabledCursor = css` + cursor: not-allowed; +`; From 605c643ca0bc626814ce63ff69dc2cf1afb80501 Mon Sep 17 00:00:00 2001 From: Sami Korpela Date: Wed, 6 Nov 2019 15:04:14 +0200 Subject: [PATCH 2/2] Disabled cursor to use for Button Snapshots updated; PanelExpansion uses Button so therefore the other snapshots were also updated --- src/components/Button/Button.tsx | 12 ++- .../Button/__snapshots__/Button.test.tsx.snap | 18 ++-- src/core/Button/Button.baseStyles.tsx | 6 +- .../Button/__snapshots__/Button.test.tsx.snap | 24 +++-- .../PanelExpansion.test.tsx.snap | 26 +++--- .../theme/__snapshots__/tokens.test.tsx.snap | 92 ++++++++++--------- 6 files changed, 106 insertions(+), 72 deletions(-) diff --git a/src/components/Button/Button.tsx b/src/components/Button/Button.tsx index d14cd8bd6..20ce82f7b 100644 --- a/src/components/Button/Button.tsx +++ b/src/components/Button/Button.tsx @@ -8,6 +8,8 @@ import React, { import { HtmlButton, HtmlButtonProps } from '../../reset'; import { VisuallyHidden } from '../Visually-hidden/Visually-hidden'; import classnames from 'classnames'; +import styled from 'styled-components'; +import { disabledCursor } from '../utils/css'; const baseClassName = 'fi-button'; const disabledClassName = `${baseClassName}--disabled`; @@ -102,6 +104,14 @@ export class Assertive extends Component { } } +const StyledHtmlButton = styled((props: ButtonProps) => ( + +))` + &.${disabledClassName} { + ${disabledCursor} + } +`; + export class Button extends Component { render() { const { @@ -126,7 +136,7 @@ export class Button extends Component { const onClickProps = !!disabled ? {} : ifMouseNoFocus(); return ( -