Skip to content

Commit 8cc394e

Browse files
apply bulk actions styles
1 parent 42ac82d commit 8cc394e

File tree

5 files changed

+26
-47
lines changed

5 files changed

+26
-47
lines changed

polaris-react/src/components/BulkActions/BulkActions.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ $bulk-actions-button-stacking-order: (
7777
border-radius: var(--p-border-radius-2);
7878
box-shadow: var(--p-shadow-deep), var(--p-shadow-popover);
7979
max-width: 100%;
80+
pointer-events: auto;
81+
margin-top: 16px;
8082

8183
.Group-measuring & {
8284
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
@@ -92,6 +94,13 @@ $bulk-actions-button-stacking-order: (
9294
button {
9395
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
9496
display: flex;
97+
&:hover {
98+
background-color: #666666;
99+
}
100+
101+
&:active {
102+
background-color: #666666 !important;
103+
}
95104
}
96105
}
97106

polaris-react/src/components/BulkActions/BulkActions.tsx

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {Transition} from 'react-transition-group';
33

44
import {debounce} from '../../utilities/debounce';
55
import {classNames} from '../../utilities/css';
6-
import {useI18n} from '../../utilities/i18n';
76
import {clamp} from '../../utilities/clamp';
87
import type {
98
BadgeAction,
@@ -49,9 +48,7 @@ export interface BulkActionsProps {
4948
width: number;
5049
}
5150

52-
type CombinedProps = BulkActionsProps & {
53-
i18n: ReturnType<typeof useI18n>;
54-
};
51+
type CombinedProps = BulkActionsProps;
5552

5653
interface State {
5754
popoverVisible: boolean;
@@ -202,8 +199,7 @@ class BulkActionsInner extends PureComponent<CombinedProps, State> {
202199

203200
// eslint-disable-next-line @typescript-eslint/member-ordering
204201
render() {
205-
const {selectMode, disabled, promotedActions, i18n, isSticky, width} =
206-
this.props;
202+
const {selectMode, disabled, promotedActions, isSticky, width} = this.props;
207203

208204
const actionSections = this.actionSections();
209205

@@ -214,9 +210,7 @@ class BulkActionsInner extends PureComponent<CombinedProps, State> {
214210
) {
215211
// eslint-disable-next-line no-console
216212
console.warn(
217-
i18n.translate('Polaris.ResourceList.BulkActions.warningMessage', {
218-
maxPromotedActions: MAX_PROMOTED_ACTIONS,
219-
}),
213+
`"To provide a better user experience. There should only be a maximum of ${MAX_PROMOTED_ACTIONS} promoted actions."`,
220214
);
221215
}
222216

@@ -255,12 +249,8 @@ class BulkActionsInner extends PureComponent<CombinedProps, State> {
255249
const activatorLabel =
256250
!promotedActions ||
257251
(promotedActions && numberOfPromotedActionsToRender === 0 && !measuring)
258-
? i18n.translate(
259-
'Polaris.ResourceList.BulkActions.actionsActivatorLabel',
260-
)
261-
: i18n.translate(
262-
'Polaris.ResourceList.BulkActions.moreActionsActivatorLabel',
263-
);
252+
? 'Actions'
253+
: 'More actions';
264254

265255
let combinedActions: ActionListSection[] = [];
266256

@@ -416,7 +406,5 @@ function instanceOfMenuGroupDescriptor(
416406
}
417407

418408
export function BulkActions(props: BulkActionsProps) {
419-
const i18n = useI18n();
420-
421-
return <BulkActionsInner {...props} i18n={i18n} />;
409+
return <BulkActionsInner {...props} />;
422410
}

polaris-react/src/components/Button/Button.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
handleMouseUpByBlurring,
1212
MouseUpBlurHandler,
1313
} from '../../utilities/focus';
14-
import {useI18n} from '../../utilities/i18n';
1514
import {Icon} from '../Icon';
1615
import {Spinner} from '../Spinner';
1716
import {Popover} from '../Popover';
@@ -131,8 +130,6 @@ export function Button({
131130
connectedDisclosure,
132131
dataPrimaryLink,
133132
}: ButtonProps) {
134-
const i18n = useI18n();
135-
136133
const isDisabled = disabled || loading;
137134

138135
const className = classNames(
@@ -191,12 +188,7 @@ export function Button({
191188

192189
const spinnerSVGMarkup = loading ? (
193190
<span className={styles.Spinner}>
194-
<Spinner
195-
size="small"
196-
accessibilityLabel={i18n.translate(
197-
'Polaris.Button.spinnerAccessibilityLabel',
198-
)}
199-
/>
191+
<Spinner size="small" accessibilityLabel="Loading" />
200192
</span>
201193
) : null;
202194

@@ -223,9 +215,7 @@ export function Button({
223215
monochrome && styles.monochrome,
224216
);
225217

226-
const defaultLabel = i18n.translate(
227-
'Polaris.Button.connectedDisclosureAccessibilityLabel',
228-
);
218+
const defaultLabel = 'Related actions';
229219

230220
const {disabled, accessibilityLabel: disclosureLabel = defaultLabel} =
231221
connectedDisclosure;

polaris-react/src/components/IndexTable/IndexTable.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
// stylelint-disable-next-line -- Polaris component custom properties
2424
--pc-index-table-bulk-actions-offset: 92px;
2525
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
26-
padding-bottom: var(--pc-index-table-bulk-actions-offset);
2726
border-radius: 0;
2827
}
2928

@@ -580,7 +579,7 @@ $loading-panel-height: 53px;
580579
align-items: center;
581580
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
582581
justify-content: center;
583-
margin-top: var(--p-space-4);
582+
pointer-events: none;
584583
}
585584

586585
.BulkActionsWrapperSticky {

polaris-react/src/components/IndexTable/IndexTable.tsx

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {Stack} from '../Stack';
1313
import {Spinner} from '../Spinner';
1414
import {Text} from '../Text';
1515
import {
16-
BulkAction,
16+
BulkActions,
1717
BulkActionsProps,
1818
useIsBulkActionsSticky,
1919
} from '../BulkActions';
@@ -27,7 +27,7 @@ import {
2727
} from '../../utilities/index-provider';
2828
import {AfterInitialMount} from '../AfterInitialMount';
2929
import {IndexProvider} from '../IndexProvider';
30-
import type {ActionListSection, NonEmptyArray} from '../../types';
30+
import type {NonEmptyArray} from '../../types';
3131

3232
import {getTableHeadingsBySelector} from './utilities';
3333
import {ScrollContainer, Cell, Row} from './components';
@@ -104,11 +104,6 @@ export interface IndexTableBaseProps {
104104
onboardingBadgeText?: string;
105105
undoText?: string;
106106
checkbox?: (props: IndexTableHeadingCheckbox) => React.ReactNode;
107-
renderBulkActions?: ({
108-
actions,
109-
}: {
110-
actions: (BulkAction | ActionListSection)[];
111-
}) => React.ReactNode;
112107
}
113108

114109
export interface TableHeadingRect {
@@ -142,7 +137,6 @@ function IndexTableBase({
142137
onboardingBadgeText,
143138
undoText,
144139
checkbox,
145-
renderBulkActions,
146140
...restProps
147141
}: IndexTableBaseProps) {
148142
const {
@@ -537,7 +531,7 @@ function IndexTableBase({
537531
);
538532

539533
const shouldShowActions = !condensed || selectedItemsCount;
540-
// const promotedActions = shouldShowActions ? promotedBulkActions : [];
534+
const promotedActions = shouldShowActions ? promotedBulkActions : [];
541535
const actions = shouldShowActions ? bulkActions : [];
542536

543537
const bulkActionsMarkup =
@@ -554,15 +548,14 @@ function IndexTableBase({
554548
: undefined,
555549
}}
556550
>
557-
{renderBulkActions?.({actions})}
558-
{/* <BulkActions
551+
<BulkActions
559552
selectMode={selectMode}
560553
promotedActions={promotedActions}
561554
actions={actions}
562555
onSelectModeToggle={condensed ? handleSelectModeToggle : undefined}
563556
isSticky={isBulkActionsSticky}
564557
width={bulkActionsMaxWidth}
565-
/> */}
558+
/>
566559
</div>
567560
) : null;
568561

@@ -842,9 +835,9 @@ function IndexTableBase({
842835
};
843836
}
844837

845-
// function handleSelectModeToggle() {
846-
// handleSelectionChange(SelectionType.All, false);
847-
// }
838+
function handleSelectModeToggle() {
839+
handleSelectionChange(SelectionType.All, false);
840+
}
848841
}
849842

850843
const isBreakpointsXS = () => {

0 commit comments

Comments
 (0)