Skip to content

Commit 7705ca6

Browse files
Merge pull request #19 from glints-dev/feat/index-table-styling
Index table styling
2 parents 42ac82d + 24441c2 commit 7705ca6

File tree

8 files changed

+38
-50
lines changed

8 files changed

+38
-50
lines changed

.changeset/serious-dolls-travel.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'polaris-glints': minor
3+
'@shopify/stylelint-polaris': minor
4+
---
5+
6+
IndexTable styling changes

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/CheckableButton/CheckableButton.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@import '../ResourceList/variables';
33

44
$button-vertical-padding: calc(
5-
(36px - var(--p-font-line-height-2) - var(--p-space-05)) / 2
5+
(38px - var(--p-font-line-height-2) - var(--p-space-05)) / 2
66
);
77

88
.CheckableButton {
@@ -61,7 +61,8 @@ $button-vertical-padding: calc(
6161
overflow: hidden;
6262
max-width: 100%;
6363
text-overflow: ellipsis;
64-
font-size: var(--p-font-size-100);
64+
font-size: var(--p-font-size-200);
65+
font-weight: var(--p-font-weight-semibold);
6566
font-family: 'Noto Sans TC', 'Noto Sans SC', 'Noto Sans KR', 'Noto Sans JP',
6667
'Noto Sans', sans-serif;
6768
// padding to fix the bottom of letters being cutoff by overflow: hidden

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const CheckableButton = forwardRef(function CheckableButton(
5050
checkbox?.({
5151
onChange: onToggleAll,
5252
checked: selected,
53+
indeterminate: selected === 'indeterminate',
5354
})
5455
) : (
5556
<Checkbox

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

Lines changed: 2 additions & 3 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 {
@@ -605,7 +604,7 @@ $loading-panel-height: 53px;
605604
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
606605
right: 0;
607606
padding: 0 var(--p-space-2) 0 calc(var(--p-space-3) - var(--p-space-025));
608-
background: var(--p-surface);
607+
background: #f8fafc;
609608

610609
&.StickyTableHeader-condensed {
611610
padding-top: calc(var(--p-space-2) + var(--p-space-05));

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

Lines changed: 9 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';
@@ -66,6 +66,7 @@ export interface IndexTableHeadingCheckbox {
6666
label?: string;
6767
onChange?: (checked: boolean) => unknown;
6868
checked?: boolean | 'indeterminate';
69+
indeterminate?: boolean;
6970
}
7071

7172
export interface IndexTableBaseProps {
@@ -104,11 +105,6 @@ export interface IndexTableBaseProps {
104105
onboardingBadgeText?: string;
105106
undoText?: string;
106107
checkbox?: (props: IndexTableHeadingCheckbox) => React.ReactNode;
107-
renderBulkActions?: ({
108-
actions,
109-
}: {
110-
actions: (BulkAction | ActionListSection)[];
111-
}) => React.ReactNode;
112108
}
113109

114110
export interface TableHeadingRect {
@@ -142,7 +138,6 @@ function IndexTableBase({
142138
onboardingBadgeText,
143139
undoText,
144140
checkbox,
145-
renderBulkActions,
146141
...restProps
147142
}: IndexTableBaseProps) {
148143
const {
@@ -537,7 +532,7 @@ function IndexTableBase({
537532
);
538533

539534
const shouldShowActions = !condensed || selectedItemsCount;
540-
// const promotedActions = shouldShowActions ? promotedBulkActions : [];
535+
const promotedActions = shouldShowActions ? promotedBulkActions : [];
541536
const actions = shouldShowActions ? bulkActions : [];
542537

543538
const bulkActionsMarkup =
@@ -554,15 +549,14 @@ function IndexTableBase({
554549
: undefined,
555550
}}
556551
>
557-
{renderBulkActions?.({actions})}
558-
{/* <BulkActions
552+
<BulkActions
559553
selectMode={selectMode}
560554
promotedActions={promotedActions}
561555
actions={actions}
562556
onSelectModeToggle={condensed ? handleSelectModeToggle : undefined}
563557
isSticky={isBulkActionsSticky}
564558
width={bulkActionsMaxWidth}
565-
/> */}
559+
/>
566560
</div>
567561
) : null;
568562

@@ -842,9 +836,9 @@ function IndexTableBase({
842836
};
843837
}
844838

845-
// function handleSelectModeToggle() {
846-
// handleSelectionChange(SelectionType.All, false);
847-
// }
839+
function handleSelectModeToggle() {
840+
handleSelectionChange(SelectionType.All, false);
841+
}
848842
}
849843

850844
const isBreakpointsXS = () => {

0 commit comments

Comments
 (0)