Skip to content

Commit

Permalink
Add custom cursor icons back (#3649)
Browse files Browse the repository at this point in the history
* Add custom cursor icons for column resizing back
  • Loading branch information
snowystinger authored Mar 23, 2023
1 parent 7657820 commit 3c0d990
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 39 deletions.
1 change: 1 addition & 0 deletions .parcelrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"docs:*.{js,ts,tsx,json}": ["parcel-transformer-docs", "@parcel/transformer-inline"],
"docs-json:*.{js,ts,tsx,json}": ["parcel-transformer-docs"],
"packages/*/*/intl/*.json": ["parcel-transformer-intl"],
"data-url:*.svg": ["@parcel/transformer-svg", "@parcel/transformer-inline-string"],
"*.{md,mdx}": ["parcel-transformer-mdx-docs"],
"*.svg": ["@parcel/transformer-svg-react"],
"*.css": ["...", "parcel-transformer-css-env"],
Expand Down

This file was deleted.

13 changes: 0 additions & 13 deletions packages/@adobe/spectrum-css-temp/components/table/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -497,19 +497,6 @@ svg.spectrum-Table-sortedIcon {
}
}

.resize-ew,
.spectrum-Table-columnResizer--ewresize {
cursor: ew-resize !important;
}
.resize-e,
.spectrum-Table-columnResizer--eresize {
cursor: e-resize !important;
}
.resize-w,
.spectrum-Table-columnResizer--wresize {
cursor: w-resize !important;
}

@media (forced-colors: active) {
.spectrum-Table-row {
&:focus-ring {
Expand Down
17 changes: 9 additions & 8 deletions packages/@react-spectrum/table/src/Resizer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import intlMessages from '../intl/*.json';
import {mergeProps} from '@react-aria/utils';
import React, {Key, RefObject, useEffect, useState} from 'react';
import ReactDOM from 'react-dom';
import rspStyles from './table.css';
import styles from '@adobe/spectrum-css-temp/components/table/vars.css';
import {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';
import {useTableColumnResize} from '@react-aria/table';
Expand All @@ -25,9 +26,9 @@ interface ResizerProps<T> {
}

let CURSOR_CLASSES = {
w: classNames(styles, 'resize-w'),
e: classNames(styles, 'resize-e'),
ew: classNames(styles, 'resize-ew')
w: classNames(rspStyles, 'resize-w'),
e: classNames(rspStyles, 'resize-e'),
ew: classNames(rspStyles, 'resize-ew')
};

function Resizer<T>(props: ResizerProps<T>, ref: RefObject<HTMLInputElement>) {
Expand Down Expand Up @@ -116,11 +117,11 @@ function Resizer<T>(props: ResizerProps<T>, ref: RefObject<HTMLInputElement>) {
className={classNames(
styles,
'spectrum-Table-columnResizer',
{
'spectrum-Table-columnResizer--ewresize': !(isEResizable && isWResizable),
'spectrum-Table-columnResizer--eresize': direction === 'rtl' ? isWResizable : isEResizable,
'spectrum-Table-columnResizer--wresize': direction === 'rtl' ? isEResizable : isWResizable
}
classNames(rspStyles, {
'react-spectrum-Table-columnResizer--ewresize': !(isEResizable && isWResizable),
'react-spectrum-Table-columnResizer--eresize': direction === 'rtl' ? isWResizable : isEResizable,
'react-spectrum-Table-columnResizer--wresize': direction === 'rtl' ? isEResizable : isWResizable
})
)}
{...resizerProps}>
<VisuallyHidden>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions packages/@react-spectrum/table/src/table.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,16 @@
width: 100%;
height: 100%;
}

.resize-ew,
.react-spectrum-Table-columnResizer--ewresize {
cursor: url('data-url:./cursors/Cur_MoveHorizontal_9_9.svg'), ew-resize !important;
}
.resize-e,
.react-spectrum-Table-columnResizer--eresize {
cursor: url('data-url:./cursors/Cur_MoveToRight_9_9.svg'), e-resize !important;
}
.resize-w,
.react-spectrum-Table-columnResizer--wresize {
cursor: url('data-url:./cursors/Cur_MoveToLeft_9_9.svg'), w-resize !important;
}

1 comment on commit 3c0d990

@rspbot
Copy link

@rspbot rspbot commented on 3c0d990 Mar 23, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.