-
Notifications
You must be signed in to change notification settings - Fork 194
Remove tremor completely #3777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove tremor completely #3777
Changes from all commits
4c119bb
1bbf046
4388236
7446ee5
68e2cbe
50d1091
7f308b6
bda0f07
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,9 +1,7 @@ | ||||||
| import '@tremor/react/dist/esm/tremor.css'; | ||||||
|
|
||||||
| import { Icon as BpIcon } from '@blueprintjs/core'; | ||||||
| import { Button } from '@blueprintjs/core'; | ||||||
| import { IconNames } from '@blueprintjs/icons'; | ||||||
| import { Button, Flex } from '@tremor/react'; | ||||||
| import React, { useCallback } from 'react'; | ||||||
| import GradingFlex from 'src/commons/grading/GradingFlex'; | ||||||
|
|
||||||
| import { AssessmentOverview } from '../../../../commons/assessment/AssessmentTypes'; | ||||||
|
|
||||||
|
|
@@ -44,22 +42,16 @@ const EditTeamSizeCell: React.FC<Props> = ({ data, onTeamSizeChange }) => { | |||||
| }; | ||||||
|
|
||||||
| return ( | ||||||
| <Flex> | ||||||
| <GradingFlex alignItems="center" style={{ columnGap: '0.5rem' }}> | ||||||
| <Button | ||||||
| size="xs" | ||||||
| icon={() => <BpIcon icon={IconNames.MINUS} />} | ||||||
| variant="light" | ||||||
| variant="minimal" | ||||||
| icon={IconNames.MINUS} | ||||||
| onClick={handleDecrement} | ||||||
| disabled={teamSize === minTeamSize} | ||||||
| /> | ||||||
| <span>{teamSize}</span> | ||||||
| <Button | ||||||
| size="xs" | ||||||
| icon={() => <BpIcon icon={IconNames.PLUS} />} | ||||||
| variant="light" | ||||||
| onClick={handleIncrement} | ||||||
| /> | ||||||
| </Flex> | ||||||
| <Button variant="minimal" icon={IconNames.PLUS} onClick={handleIncrement} /> | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Blueprint
Suggested change
References
|
||||||
| </GradingFlex> | ||||||
| ); | ||||||
| }; | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| import { Icon as BpIcon } from '@blueprintjs/core'; | ||
| import { Button, Position, Tooltip } from '@blueprintjs/core'; | ||
| import { IconNames } from '@blueprintjs/icons'; | ||
| import { Flex, Icon } from '@tremor/react'; | ||
| import React, { useCallback } from 'react'; | ||
| import { useDispatch } from 'react-redux'; | ||
| import { Link } from 'react-router'; | ||
| import SessionActions from 'src/commons/application/actions/SessionActions'; | ||
| import GradingFlex from 'src/commons/grading/GradingFlex'; | ||
| import { showSimpleConfirmDialog } from 'src/commons/utils/DialogHelper'; | ||
| import { useSession } from 'src/commons/utils/Hooks'; | ||
|
|
||
|
|
@@ -33,15 +33,22 @@ const TeamFormationActions: React.FC<Props> = ({ teamId }) => { | |
| }, [dispatch, teamId]); | ||
|
|
||
| return ( | ||
| <Flex justifyContent="justify-start" spaceX="space-x-2"> | ||
| <Link to={`/courses/${courseId}/teamformation/edit/${teamId}`}> | ||
| <Icon tooltip="Edit" icon={() => <BpIcon icon={IconNames.EDIT} />} variant="light" /> | ||
| </Link> | ||
| <GradingFlex> | ||
| <Tooltip placement={Position.TOP} content="Edit"> | ||
| <Link to={`/courses/${courseId}/teamformation/edit/${teamId}`}> | ||
| <Button intent="primary" icon={IconNames.EDIT} variant="minimal" /> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| </Link> | ||
| </Tooltip> | ||
|
|
||
| <button type="button" style={{ padding: 0 }} onClick={handleDeleteTeamClick}> | ||
| <Icon tooltip="Delete" icon={() => <BpIcon icon={IconNames.TRASH} />} variant="simple" /> | ||
| </button> | ||
| </Flex> | ||
| <Tooltip placement={Position.TOP} content="Delete"> | ||
| <Button | ||
| intent="danger" | ||
| icon={IconNames.TRASH} | ||
| variant="minimal" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| onClick={handleDeleteTeamClick} | ||
| /> | ||
| </Tooltip> | ||
| </GradingFlex> | ||
| ); | ||
| }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,23 @@ | ||
| import { Icon } from '@blueprintjs/core'; | ||
| import { Button, Intent } from '@blueprintjs/core'; | ||
| import { IconNames } from '@blueprintjs/icons'; | ||
| import { ColumnFilter } from '@tanstack/react-table'; | ||
| import { Badge } from '@tremor/react'; | ||
| import React from 'react'; | ||
|
|
||
| import { getBadgeColorFromLabelLegacy } from '../../grading/subcomponents/GradingBadges'; | ||
|
|
||
| // TODO: Remove after migration is completed | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| const TREMOR_TO_BLUEPRINT_INTENT: Record<string, Intent> = { | ||
| indigo: Intent.PRIMARY, | ||
| emerald: Intent.SUCCESS, | ||
| sky: Intent.PRIMARY, | ||
| purple: Intent.PRIMARY, | ||
| gray: Intent.NONE, | ||
| red: Intent.DANGER, | ||
| yellow: Intent.WARNING, | ||
| green: Intent.SUCCESS, | ||
| blue: Intent.PRIMARY | ||
| }; | ||
|
|
||
| type Props = { | ||
| filter: ColumnFilter; | ||
| onRemove: (filter: ColumnFilter) => void; | ||
|
|
@@ -14,14 +26,13 @@ type Props = { | |
| const FilterBadge: React.FC<Props> = ({ filter, onRemove }) => { | ||
| let filterValue = filter.value as string; | ||
| filterValue = filterValue.charAt(0).toUpperCase() + filterValue.slice(1); | ||
| const legacyColor = getBadgeColorFromLabelLegacy(filterValue); | ||
| const intent = TREMOR_TO_BLUEPRINT_INTENT[legacyColor] || Intent.NONE; | ||
|
|
||
| return ( | ||
| <button type="button" onClick={() => onRemove(filter)} style={{ padding: 0 }}> | ||
| <Badge | ||
| text={filterValue} | ||
| icon={() => <Icon icon={IconNames.CROSS} style={{ marginRight: '0.25rem' }} />} | ||
| color={getBadgeColorFromLabelLegacy(filterValue)} | ||
| /> | ||
| </button> | ||
| <Button intent={intent} icon={IconNames.CROSS} onClick={() => onRemove(filter)}> | ||
| {filterValue} | ||
| </Button> | ||
| ); | ||
| }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,4 @@ | ||||||
| import '@tremor/react/dist/esm/tremor.css'; | ||||||
|
|
||||||
| import { Icon as BpIcon } from '@blueprintjs/core'; | ||||||
| import { Button, HTMLTable, Icon as BpIcon, InputGroup } from '@blueprintjs/core'; | ||||||
| import { IconNames } from '@blueprintjs/icons'; | ||||||
| import { | ||||||
| Column, | ||||||
|
|
@@ -14,20 +12,9 @@ import { | |||||
| Row, | ||||||
| useReactTable | ||||||
| } from '@tanstack/react-table'; | ||||||
| import { | ||||||
| Bold, | ||||||
| Button, | ||||||
| Flex, | ||||||
| Table, | ||||||
| TableBody, | ||||||
| TableCell, | ||||||
| TableHead, | ||||||
| TableHeaderCell, | ||||||
| TableRow, | ||||||
| Text, | ||||||
| TextInput | ||||||
| } from '@tremor/react'; | ||||||
| import React, { useState } from 'react'; | ||||||
| import GradingFlex from 'src/commons/grading/GradingFlex'; | ||||||
| import GradingText from 'src/commons/grading/GradingText'; | ||||||
| import { objectKeys } from 'src/commons/utils/TypeHelper'; | ||||||
| import { TeamFormationOverview } from 'src/features/teamFormation/TeamFormationTypes'; | ||||||
|
|
||||||
|
|
@@ -140,72 +127,72 @@ const TeamFormationTable: React.FC<TeamFormationTableProps> = ({ group, teams }) | |||||
|
|
||||||
| return ( | ||||||
| <> | ||||||
| <Flex marginTop="mt-2" justifyContent="justify-between" alignItems="items-center"> | ||||||
| <Flex alignItems="items-center" spaceX="space-x-2"> | ||||||
| <div style={{ display: 'flex', gap: '0.5rem', alignItems: 'center', height: '1.75rem' }}> | ||||||
| <GradingFlex | ||||||
| justifyContent="space-between" | ||||||
| alignItems="center" | ||||||
| style={{ marginTop: '0.5rem' }} | ||||||
| > | ||||||
| <GradingFlex alignItems="center" style={{ columnGap: '0.5rem' }}> | ||||||
| <GradingFlex alignItems="center" style={{ columnGap: '0.5rem', height: '1.75rem' }}> | ||||||
| <BpIcon icon={IconNames.FILTER_LIST} /> | ||||||
| <Text> | ||||||
| <GradingText> | ||||||
| {columnFilters.length > 0 | ||||||
| ? 'Filters: ' | ||||||
| : 'No filters applied. Click on any cell to filter by its value.'}{' '} | ||||||
| </Text> | ||||||
| </div> | ||||||
| </GradingText> | ||||||
| </GradingFlex> | ||||||
| <TeamFormationFilters filters={columnFilters} onFilterRemove={handleFilterRemove} /> | ||||||
| </Flex> | ||||||
| </GradingFlex> | ||||||
|
|
||||||
| <TextInput | ||||||
| maxWidth="max-w-sm" | ||||||
| icon={() => <BpIcon icon={IconNames.SEARCH} style={{ marginLeft: '0.75rem' }} />} | ||||||
| <InputGroup | ||||||
| style={{ maxWidth: '14rem' }} | ||||||
| leftIcon={IconNames.SEARCH} | ||||||
| placeholder="Search for any value here..." | ||||||
| onChange={e => setGlobalFilter(e.target.value)} | ||||||
| /> | ||||||
| </Flex> | ||||||
| <Table marginTop="mt-2"> | ||||||
| <TableHead> | ||||||
| </GradingFlex> | ||||||
| <HTMLTable style={{ marginTop: '0.5rem', width: '100%' }}> | ||||||
| <thead> | ||||||
| {table.getHeaderGroups().map(headerGroup => ( | ||||||
| <TableRow key={headerGroup.id}> | ||||||
| <tr key={headerGroup.id}> | ||||||
| {headerGroup.headers.map(header => ( | ||||||
| <TableHeaderCell key={header.id}> | ||||||
| <th key={header.id}> | ||||||
| {header.isPlaceholder | ||||||
| ? null | ||||||
| : flexRender(header.column.columnDef.header, header.getContext())} | ||||||
| </TableHeaderCell> | ||||||
| </th> | ||||||
| ))} | ||||||
| </TableRow> | ||||||
| </tr> | ||||||
| ))} | ||||||
| </TableHead> | ||||||
| <TableBody> | ||||||
| </thead> | ||||||
| <tbody> | ||||||
| {table.getRowModel().rows.map(row => ( | ||||||
| <TableRow key={row.id}> | ||||||
| <tr key={row.id}> | ||||||
| {row.getVisibleCells().map(cell => ( | ||||||
| <TableCell key={cell.id}> | ||||||
| {flexRender(cell.column.columnDef.cell, cell.getContext())} | ||||||
| </TableCell> | ||||||
| <td key={cell.id}>{flexRender(cell.column.columnDef.cell, cell.getContext())}</td> | ||||||
| ))} | ||||||
| </TableRow> | ||||||
| </tr> | ||||||
| ))} | ||||||
| </TableBody> | ||||||
| </Table> | ||||||
| </tbody> | ||||||
| </HTMLTable> | ||||||
| <div> | ||||||
| <Flex justifyContent="justify-center" spaceX="space-x-3"> | ||||||
| <GradingFlex justifyContent="center" style={{ columnGap: '0.75rem' }}> | ||||||
| <Button | ||||||
| size="xs" | ||||||
| icon={() => <BpIcon icon={IconNames.ARROW_LEFT} />} | ||||||
| variant="light" | ||||||
| variant="minimal" | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
| icon={IconNames.ARROW_LEFT} | ||||||
| onClick={() => table.previousPage()} | ||||||
| disabled={!table.getCanPreviousPage()} | ||||||
| /> | ||||||
| <Bold> | ||||||
| <GradingText style={{ fontWeight: 'bold' }}> | ||||||
| Page {table.getState().pagination.pageIndex + 1} of {table.getPageCount()} | ||||||
| </Bold> | ||||||
| </GradingText> | ||||||
| <Button | ||||||
| size="xs" | ||||||
| icon={() => <BpIcon icon={IconNames.ARROW_RIGHT} />} | ||||||
| variant="light" | ||||||
| variant="minimal" | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
| icon={IconNames.ARROW_RIGHT} | ||||||
| onClick={() => table.nextPage()} | ||||||
| disabled={!table.getCanNextPage()} | ||||||
| /> | ||||||
| </Flex> | ||||||
| </GradingFlex> | ||||||
| </div> | ||||||
| </> | ||||||
| ); | ||||||
|
|
@@ -223,9 +210,9 @@ const Filterable: React.FC<FilterableProps> = ({ column, value, children }) => { | |||||
| }; | ||||||
|
|
||||||
| return ( | ||||||
| <button type="button" onClick={handleFilterChange} style={{ padding: 0 }}> | ||||||
| <Button variant="minimal" onClick={handleFilterChange} style={{ padding: 0 }}> | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Blueprint's
Suggested change
References
|
||||||
| {children || value} | ||||||
| </button> | ||||||
| </Button> | ||||||
| ); | ||||||
| }; | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Blueprint
Buttoncomponent does not have avariantprop. To achieve the minimal style, use theminimalboolean prop instead.