Skip to content

Commit

Permalink
Adjusted caret
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickseguraoddball committed Sep 4, 2024
1 parent 3e79ea8 commit 695bce6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
22 changes: 16 additions & 6 deletions src/components/shared/CollapsableLink/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type CollapsableLinkProps = {
labelPosition?: 'top' | 'bottom';
expandOnExport?: boolean;
setParentOpen?: (isOpen: boolean) => void;
horizontalCaret?: boolean;
};

const CollapsableLink = ({
Expand All @@ -39,7 +40,8 @@ const CollapsableLink = ({
showDescription,
labelPosition = 'top',
expandOnExport = false,
setParentOpen
setParentOpen,
horizontalCaret = false
}: CollapsableLinkProps) => {
// TODO: should this state instead be held in the parent and passed in as prop?
// Followup: if the state should remain here, how do we test the component when it's open?
Expand Down Expand Up @@ -69,12 +71,20 @@ const CollapsableLink = ({
);
};

const OpenCaret = horizontalCaret ? (
<Icon.NavigateNext className="top-05 margin-right-05" />
) : (
<Icon.ExpandMore className="top-05 margin-right-05" />
);

const DownCaret = horizontalCaret ? (
<Icon.ExpandMore className="top-05 margin-right-05" />
) : (
<Icon.ExpandLess className="top-05 margin-right-05" />
);

const renderCaret = () => {
return isOpen ? (
<Icon.ExpandLess className="top-05 margin-right-05" />
) : (
<Icon.ExpandMore className="top-05 margin-right-05" />
);
return isOpen ? DownCaret : OpenCaret;
};

const expandIcon = eyeIcon ? renderEyeIcon() : renderCaret();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const RoleInfo = ({ className }: RoleInfoProps) => {
className
)}
label={collaboratorsMiscT('rolesInfo.label')}
horizontalCaret
>
<ul className="margin-y-0 padding-left-4">
{roleInfoConfig.baseRoles.map((role: string, index: number) => (
Expand Down
11 changes: 4 additions & 7 deletions src/views/ModelPlan/Collaborators/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,11 @@ const CollaboratorsTable = ({
Header: collaboratorsMiscT('table.role'),
accessor: 'teamRoles',

Cell: ({ teamRoles }: CollaboratorType) => {
Cell: (row: any) => {
const roles = row.value as CollaboratorType['teamRoles'];
const modelLeadFirst = [
...teamRoles.filter(
(role: TeamRole) => role === TeamRole.MODEL_LEAD
),
...teamRoles.filter(
(role: TeamRole) => role !== TeamRole.MODEL_LEAD
)
...roles.filter((role: TeamRole) => role === TeamRole.MODEL_LEAD),
...roles.filter((role: TeamRole) => role !== TeamRole.MODEL_LEAD)
];
return modelLeadFirst
.map((role: TeamRole) => {
Expand Down

0 comments on commit 695bce6

Please sign in to comment.