Skip to content

Commit

Permalink
fix(Datatable): update styling
Browse files Browse the repository at this point in the history
  • Loading branch information
julesbarr committed Sep 4, 2023
1 parent d445034 commit 6a6a5a8
Show file tree
Hide file tree
Showing 89 changed files with 67 additions and 22 deletions.
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.
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.
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.
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.
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.
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.
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .storybook/image-snapshots/expected/components_Icon_Icons List.png
13 changes: 6 additions & 7 deletions src/components/Datatable/BatchModule/BatchModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@ import { isNonEmptyArray } from 'ramda-adjunct';
import styled from 'styled-components';
import PropTypes from 'prop-types';

import { pxToRem } from '../../../utils';
import { SpaceSizes } from '../../../theme';
import { getSpace } from '../../../utils';
import { SSCIconNames } from '../../../theme/icons/icons.enums';
import { Inline, Padbox } from '../../layout';
import { Inline } from '../../layout';
import { ColumnsControls } from '../components/ColumnsControls';
import { ControlButton } from '../components/ControlButton';
import { BatchActions } from './BatchActions';
import { ElementCounter } from './ElementCounter';
import { BatchModuleProps } from './BatchModule.types';
import { DatatableStore } from '../Datatable.store';

const BatchModuleWrapper = styled(Padbox)`
min-height: ${pxToRem(64)};
const BatchModuleWrapper = styled.div`
padding: ${getSpace('xs')} ${getSpace('md')};
`;

const BatchModule: React.FC<BatchModuleProps> = ({
Expand Down Expand Up @@ -49,7 +48,7 @@ const BatchModule: React.FC<BatchModuleProps> = ({
}, []);

return (
<BatchModuleWrapper paddingSize={SpaceSizes.md}>
<BatchModuleWrapper>
<Inline align="center" justify="space-between">
<Inline align="center">
{isButtonDisplayed && (
Expand All @@ -67,7 +66,7 @@ const BatchModule: React.FC<BatchModuleProps> = ({
}}
>
<ControlButton
iconName={SSCIconNames.table}
iconName={SSCIconNames.columns3}
label="Toggle columns"
onClick={() => {
setIsColumnsActive((prev) => !prev);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function ElementCounterWrapper({ children, ...props }) {
ElementCounterWrapper.displayName = 'ElementCounterWrapper';

const CounterText = styled(Text).attrs(() => ({
size: 'h4',
size: 'md',
margin: 'none',
variant: HeadingVariants.secondary,
}))`
Expand Down
4 changes: 2 additions & 2 deletions src/components/Datatable/ControlsModule/ControlsModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ function ControlsModule<D extends Record<string, unknown>>({
>
{(props) => (
<ControlButton
iconName={SSCIconNames.table}
iconName={SSCIconNames.columns3}
label="Toggle columns"
onClick={() =>
handleControlOnClick(
Expand All @@ -262,7 +262,7 @@ function ControlsModule<D extends Record<string, unknown>>({
{shouldShowFiltering && (
<ControlButton
appliedFilters={appliedFilters}
iconName={SSCIconNames.filter}
iconName={SSCIconNames.filterAlt}
// isActive={controlsState[ControlTypes.filters].isActive}
label="Filters"
onClick={() =>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Datatable/Datatable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const StyledDatatable = styled(Padbox)`
flex-direction: column;
position: relative;
border: 1px solid ${getColor('neutral.400')};
border-radius: ${getRadii('default')};
background: ${getColor('neutral.200')};
border-radius: ${getRadii('double')};
background: ${getColor('neutral.0')};
`;

const mapSelectedRows = <D,>(defaultSelectedRowIds: IdType<D>[]) =>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const NoDataContainer = styled(Padbox)`
const TableWrapper = styled.div`
border: 1px solid ${getColor('neutral.400')};
border-top-width: 0;
background: ${getColor('neutral.200')};
background: ${getColor('neutral.0')};
border-radius: ${getRadii('default')};
`;

Expand Down
12 changes: 6 additions & 6 deletions src/components/_internal/BaseTable/BaseTable.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
getFontWeight,
getFormStyle,
getRadii,
getSpace,
getToken,
pxToRem,
} from '../../../utils';
Expand All @@ -30,19 +31,18 @@ export const BaseTableContainer = styled.div`
overflow-x: auto;
&::-webkit-scrollbar {
box-sizing: content-box;
outline: 1px solid ${getColor('neutral.400')};
height: ${pxToRem(20)};
box-sizing: border-box;
height: ${pxToRem(24)};
}
&::-webkit-scrollbar-thumb {
border-radius: ${getRadii('round')};
background-color: ${getColor('neutral.600')};
border: 6px solid ${getColor('neutral.200')};
background-color: ${getColor('primary.500')};
border: ${getSpace('sm')} solid ${getColor('neutral.0')};
}
&::-webkit-scrollbar-track-piece {
border-radius: ${getRadii('round')};
background-color: ${getColor('neutral.300')};
border: 6px solid ${getColor('neutral.200')};
border: ${getSpace('sm')} solid ${getColor('neutral.0')};
}
&:focus-visible {
outline-color: ${getColor('primary.500')};
Expand Down
5 changes: 3 additions & 2 deletions src/components/_internal/BaseTable/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { FooterProps } from './Footer.types';
import GoToPage from './GoToPage';
import { Pagination } from '../../../Pagination';
import { SpaceSizes } from '../../../../theme';
import { PaddingTypes } from '../../../layout/Padbox/Padbox.enums';

const StyledFooter = styled(Padbox)`
display: flex;
flex: 0 0 ${pxToRem(64)};
height: ${pxToRem(64)};
align-items: center;
`;
const LoadingContainer = styled.div`
padding: ${pxToRem(8, 24, 8, 8)};
Expand All @@ -38,6 +38,7 @@ const Footer: React.FC<FooterProps> = ({
data-testid="footer"
flexDirection="row"
paddingSize={SpaceSizes.md}
paddingType={PaddingTypes.squish}
>
<LoadingContainer>
{isDataLoading && (
Expand Down
2 changes: 1 addition & 1 deletion src/components/_internal/BaseTable/Head/Head.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const StyledTh = styled.th<{ sticky?: string }>`
line-height: ${getLineHeight('md')};
text-align: left;
padding: ${pxToRem(12, 8)};
background-color: ${getColor('neutral.200')};
background-color: ${getColor('neutral.0')};
border-color: ${getColor('neutral.400')};
border-style: solid;
border-width: 1px 0 1px 1px;
Expand Down
16 changes: 16 additions & 0 deletions src/theme/icons/columns-3.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type {
IconDefinition,
IconName,
IconPrefix,
} from '@fortawesome/fontawesome-svg-core';

export const width = 18;
export const height = 14;
export const unicode = 'e032';
export const svgPathData =
'M16.25 0.625C17.207 0.625 18 1.41797 18 2.375V11.125C18 12.1094 17.207 12.875 16.25 12.875H2.25C1.26562 12.875 0.5 12.1094 0.5 11.125V2.375C0.5 1.41797 1.26562 0.625 2.25 0.625H16.25ZM5.75 2.375H2.25V11.125H5.75V2.375ZM7.5 11.125H11V2.375H7.5V11.125ZM16.25 2.375H12.75V11.125H16.25V2.375Z';
export const columns3 = {
prefix: 'ssc' as IconPrefix,
iconName: 'columns-3' as IconName,
icon: [width, height, [], unicode, svgPathData],
} as IconDefinition;
25 changes: 25 additions & 0 deletions src/theme/icons/filterAlt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*!
* Font Awesome Free 6.1.2 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
* Copyright 2022 Fonticons, Inc.
*/

/* solid - filter */

import type {
IconDefinition,
IconName,
IconPrefix,
} from '@fortawesome/fontawesome-svg-core';

export const width = 16;
export const height = 14;
export const unicode = 'e033';
export const svgPathData =
'M0.5 1.375C0.5 0.910156 0.882812 0.5 1.375 0.5H11.875C12.3398 0.5 12.75 0.910156 12.75 1.375C12.75 1.86719 12.3398 2.25 11.875 2.25H1.375C0.882812 2.25 0.5 1.86719 0.5 1.375ZM2.25 5.75C2.25 5.28516 2.63281 4.875 3.125 4.875H10.125C10.5898 4.875 11 5.28516 11 5.75C11 6.24219 10.5898 6.625 10.125 6.625H3.125C2.63281 6.625 2.25 6.24219 2.25 5.75ZM7.5 11H5.75C5.25781 11 4.875 10.6172 4.875 10.125C4.875 9.66016 5.25781 9.25 5.75 9.25H7.5C7.96484 9.25 8.375 9.66016 8.375 10.125C8.375 10.6172 7.96484 11 7.5 11Z';

export const filterAlt = {
prefix: 'ssc' as IconPrefix,
iconName: 'filterAlt' as IconName,
icon: [width, height, [], unicode, svgPathData],
} as IconDefinition;
2 changes: 2 additions & 0 deletions src/theme/icons/icons.enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export const SSCIconNames = {
angleDown: 'angle-down',
table: 'table',
infoCircleOutline: 'info-circle-outline',
columns3: 'columns-3',
filterAlt: 'filterAlt',
} as const;

export const IconTypes = {
Expand Down
2 changes: 2 additions & 0 deletions src/theme/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,5 @@ export { angleUp } from './angleUp';
export { angleDown } from './angleDown';
export { table } from './table';
export { infoCircleOutline } from './infoCircleOutline';
export { columns3 } from './columns-3';
export { filterAlt } from './filterAlt';

0 comments on commit 6a6a5a8

Please sign in to comment.