Skip to content

Commit

Permalink
Merge pull request #122 from M3nin0/dev
Browse files Browse the repository at this point in the history
table: improving mobile experience
  • Loading branch information
M3nin0 authored Apr 17, 2024
2 parents 76bdf5c + c6c8d85 commit 75bbe74
Show file tree
Hide file tree
Showing 25 changed files with 249 additions and 609 deletions.
125 changes: 0 additions & 125 deletions src/lib/components/form/base/fields/MarketplacePricingPlansField.js

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions src/lib/components/form/base/fields/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,3 @@ export { WorkProgrammeActivityField } from './WorkProgrammeActivityField';

export { ResourceTypeField } from './ResourceTypeField';
export { AuthorsField } from './AuthorsField';

export { MarketplacePricingPlansField } from './MarketplacePricingPlansField';
16 changes: 14 additions & 2 deletions src/lib/components/list/base/EventItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ export const EventItem = ({ eventData }) => {
</Grid>
<Grid padded>
<Grid.Row columns={2}>
<Grid.Column largeScreen={12} widescreen={12} computer={12} mobile={16} tablet={12}>
<Grid.Column
largeScreen={12}
widescreen={12}
computer={12}
mobile={16}
tablet={12}
>
<Header as={'h3'}>{eventData.title}</Header>
</Grid.Column>
<Grid.Column
Expand All @@ -46,7 +52,13 @@ export const EventItem = ({ eventData }) => {
</Grid.Column>
</Grid.Row>
<Grid.Row verticalAlign={'bottom'}>
<Grid.Column largeScreen={9} widescreen={9} computer={9} mobile={16} tablet={9}>
<Grid.Column
largeScreen={9}
widescreen={9}
computer={9}
mobile={16}
tablet={9}
>
<Grid doubling>
<Grid.Column
largeScreen={10}
Expand Down
27 changes: 14 additions & 13 deletions src/lib/components/list/base/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,22 @@ export const extractProgrammeActivityAcronym = (programmeActivityName) =>
* date: string
* }} Object with the new version of the record.
*/
export const mutateRecordData = (data, labelType = "initiative", labelColor = "primary") => {
export const mutateRecordData = (
data,
labelType = 'initiative',
labelColor = 'primary'
) => {
// Extracting labels
let label = extractProgrammeActivityAcronym(
_get(data, 'metadata.geo_work_programme_activity.title.en')
) || "Community";
let label =
extractProgrammeActivityAcronym(
_get(data, 'metadata.geo_work_programme_activity.title.en')
) || 'Community';

if (labelType === "resourceType") {
label = _get(
data,
"ui.resource_type.title_l10n",
"No resource type"
);
if (labelType === 'resourceType') {
label = _get(data, 'ui.resource_type.title_l10n', 'No resource type');
}

return ({
return {
title: _get(data, 'metadata.title', 'No title'),
authors: data.ui.creators.creators
.slice(0, 3)
Expand All @@ -57,9 +58,9 @@ export const mutateRecordData = (data, labelType = "initiative", labelColor = "p
'ui.publication_date_l10n_long',
'No publication date found.'
),
labelColor: labelColor || "primary",
labelColor: labelColor || 'primary',
url: _get(data, 'links.self_html'),
})
};
};

/**
Expand Down
7 changes: 4 additions & 3 deletions src/lib/components/table/base/BaseTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export const BaseTable = ({
}) => {
return (
<Table {...uiProps} {...getTableProps()}>

{showHeader && (
<Table.Header>
<Table.Row>
Expand All @@ -42,7 +41,9 @@ export const BaseTable = ({
: null
}
{...column.getHeaderProps(
column.getSortByToggleProps ? column.getSortByToggleProps() : {}
column.getSortByToggleProps
? column.getSortByToggleProps()
: {}
)}
>
{column.render('Header')}
Expand Down Expand Up @@ -91,5 +92,5 @@ BaseTable.propTypes = {
};

BaseTable.defaultProps = {
showHeader: true
showHeader: true,
};
12 changes: 8 additions & 4 deletions src/lib/components/table/moldure/PaginableTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,16 @@ export const PaginableTable = ({
state: { pageSize, globalFilter },
preGlobalFilteredRows,
setGlobalFilter,
visibleColumns
visibleColumns,
} = useTable(
{
columns: columnsConfiguration,
data: data,
initialState: { pageIndex: 0, pageSize: pageSizeSorted[0], ...initialState },
initialState: {
pageIndex: 0,
pageSize: pageSizeSorted[0],
...initialState,
},
},
useGlobalFilter,
useSortBy,
Expand All @@ -76,7 +80,7 @@ export const PaginableTable = ({
}

return (
<Container>
<>
<BaseTable
rows={page}
columns={visibleColumns}
Expand Down Expand Up @@ -126,7 +130,7 @@ export const PaginableTable = ({
</Grid>
</>
)}
</Container>
</>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,15 @@
.table-external-resources .ui.container .grid p {
overflow-wrap: break-word;
}

.table-external-resources .ui.grid .row .column.pt-0 {
padding-top: 0 !important;
}

.table-external-resources .ui.grid .row .column.pt-1 {
padding-top: 1px !important;
}

.table-external-resources .ui.table td {
overflow: visible;
}
Loading

0 comments on commit 75bbe74

Please sign in to comment.