Skip to content

Commit

Permalink
fix: Added scrollbehaviour on table
Browse files Browse the repository at this point in the history
  • Loading branch information
mheggelund committed Sep 4, 2023
1 parent b7476d3 commit b252408
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 50 deletions.
6 changes: 6 additions & 0 deletions src/components/Table.styled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import styled from 'styled-components'

export const StyledDiv = styled.div`
overflow-x: auto;
padding-bottom: 15px;
`
103 changes: 53 additions & 50 deletions src/components/Table.tsx
Original file line number Diff line number Diff line change
@@ -1,61 +1,64 @@
import { Chip } from '@equinor/eds-core-react'
import { EdsDataGrid } from '@equinor/eds-data-grid-react'
import { useGetAnalogueModels } from '../hooks/useGetAnalogueModels'
import * as Styled from './Table.styled'
import { EdsDataGrid } from '@equinor/eds-data-grid-react'

export const Table = () => {
const { data: models } = useGetAnalogueModels()

if (!models) return <p>Loading...</p>

return (
<EdsDataGrid
enableSorting
enablePagination
emptyMessage="Empty :("
rows={models}
columns={[
{
accessorKey: 'analogueModelId',
header: 'Model ID',
id: 'analogueModelId',
},
{ accessorKey: 'name', header: 'Name', id: 'name' },
{
accessorKey: 'description',
header: 'Description',
id: 'description',
},
{
accessorKey: 'isApproved',
header: 'Result',
cell: () => <Chip>{'Approved'}</Chip>,
},
{
accessorKey: 'modified',
header: 'Last Modified',
cell: () => <div>{'<Last Modified>'}</div>,
},
{
accessorKey: 'analogue',
header: 'Analogue',
cell: () => <div>{'<Analogue>'}</div>,
},
{
accessorKey: 'formation',
header: 'Formation',
cell: () => <div>{'<Formation>'}</div>,
},
{
accessorKey: 'field',
header: 'Field',
cell: () => <div>{'<Field>'}</div>,
},
{
accessorKey: 'isProcessed',
header: 'Status',
id: 'isProcessed',
},
]}
/>
<Styled.StyledDiv>
<EdsDataGrid
enableSorting
enablePagination
emptyMessage="Empty :("
rows={models}
columns={[
{
accessorKey: 'analogueModelId',
header: 'Model ID',
id: 'analogueModelId',
},
{ accessorKey: 'name', header: 'Name', id: 'name' },
{
accessorKey: 'description',
header: 'Description',
id: 'description',
},
{
accessorKey: 'isApproved',
header: 'Result',
cell: () => <Chip>{'Approved'}</Chip>,
},
{
accessorKey: 'modified',
header: 'Last Modified',
cell: () => <div>{'<Last Modified>'}</div>,
},
{
accessorKey: 'analogue',
header: 'Analogue',
cell: () => <div>{'<Analogue>'}</div>,
},
{
accessorKey: 'formation',
header: 'Formation',
cell: () => <div>{'<Formation>'}</div>,
},
{
accessorKey: 'field',
header: 'Field',
cell: () => <div>{'<Field>'}</div>,
},
{
accessorKey: 'isProcessed',
header: 'Status',
id: 'isProcessed',
},
]}
/>
</Styled.StyledDiv>
)
}

0 comments on commit b252408

Please sign in to comment.