Skip to content

Commit

Permalink
FIxing syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewshaver committed Nov 1, 2024
1 parent 55128c4 commit 04902ba
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions website/src/components/sortableTable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@ const parseMarkdownTable = (markdown) => {
const rows = markdown.trim().split('\n');
const headers = rows[0].split('|').map((header) => header.trim()).filter(Boolean);

// Parse the alignment row
const alignmentsRow = rows[1].split('|').map((align) => align.trim()).filter(Boolean);
const columnAlignments = alignmentsRow.map((alignment) => {
if (alignment.startsWith(':') && alignment.endsWith(':')) {
return 'center'; // :-----:
return 'center';
} else if (alignment.startsWith(':')) {
return 'left'; // :-----
return 'left';
} else if (alignment.endsWith(':')) {
return 'right'; // -----:
return 'right';
} else {
return 'left'; // Default alignment
return 'left';
}
});

Expand Down Expand Up @@ -56,7 +55,7 @@ const SortableTable = ({ children }) => {
style={{
cursor: 'pointer',
position: 'relative',
textAlign: columnAlignments[index], // Use detected alignment
textAlign: columnAlignments[index],
padding: '10px'
}}
>
Expand Down Expand Up @@ -89,7 +88,7 @@ const SortableTable = ({ children }) => {
<td
key={cellIndex}
style={{
textAlign: columnAlignments[cellIndex], // Use detected alignment
textAlign: columnAlignments[cellIndex],
padding: '8px'
}}
>
Expand Down

0 comments on commit 04902ba

Please sign in to comment.