Skip to content

Commit

Permalink
[admin] support rtl
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedElywa committed Apr 3, 2021
1 parent f18cff5 commit 9d18f42
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions packages/admin/src/PrismaTable/Table/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useContext, useRef, useState } from 'react';
import styled from 'styled-components';
import styled, { css } from 'styled-components';
import { useFilters, usePagination, useSortBy, useTable } from 'react-table';
import { breakpointDown } from '@paljs/ui/breakpoints';
import { Card, CardBody } from '@paljs/ui/Card';
Expand Down Expand Up @@ -523,22 +523,28 @@ export const Table: React.FC<TableProps> = ({
};

const StyledTable = styled.table<{ columnSize: number }>`
border-spacing: 0;
${({ theme, columnSize }) =>
css`
border-spacing: 0;
width: 100%;
tbody tr:nth-child(2n) {
background-color: ${(props) => props.theme.backgroundBasicColor2};
background-color: ${theme.backgroundBasicColor2};
}
tbody tr:hover {
background: ${(props) => props.theme.backgroundBasicColor3} !important;
background: ${theme.backgroundBasicColor3} !important;
}
thead tr {
background: ${(props) => props.theme.backgroundBasicColor2};
background: ${theme.backgroundBasicColor2};
th {
border-top: 1px solid ${(props) => props.theme.backgroundBasicColor3};
border-left: 1px solid ${(props) => props.theme.backgroundBasicColor3};
border-top: 1px solid ${theme.backgroundBasicColor3};
border-${theme.dir === 'rtl' ? 'right' : 'left'}: 1px solid ${
theme.backgroundBasicColor3
};
:last-child {
border-right: 1px solid ${(props) => props.theme.backgroundBasicColor3};
border-${theme.dir === 'rtl' ? 'left' : 'right'}: 1px solid ${
theme.backgroundBasicColor3
};
}
}
}
Expand All @@ -547,7 +553,7 @@ const StyledTable = styled.table<{ columnSize: number }>`
:last-child {
td {
text-align: start;
border: 1px solid ${(props) => props.theme.backgroundBasicColor2};
border: 1px solid ${theme.backgroundBasicColor2};
}
}
}
Expand All @@ -560,16 +566,20 @@ const StyledTable = styled.table<{ columnSize: number }>`
th,
td {
max-width: ${({ columnSize }) => (columnSize > 150 ? columnSize : 150)}px;
max-width: ${columnSize > 150 ? columnSize : 150}px;
margin: 0;
padding: 0.5rem;
border-top: 1px solid ${(props) => props.theme.backgroundBasicColor2};
border-left: 1px solid ${(props) => props.theme.backgroundBasicColor2};
border-top: 1px solid ${theme.backgroundBasicColor2};
border-${theme.dir === 'rtl' ? 'right' : 'left'}: 1px solid ${
theme.backgroundBasicColor2
};
text-align: center;
:last-child {
border-right: 1px solid ${(props) => props.theme.backgroundBasicColor2};
border-${theme.dir === 'rtl' ? 'left' : 'right'}: 1px solid ${
theme.backgroundBasicColor2
};
}
}
`}
`;

const StyledButton = styled(Button)`
Expand Down

0 comments on commit 9d18f42

Please sign in to comment.