Skip to content

Commit

Permalink
Merge pull request #102 from cipick/feature/remove-ballot
Browse files Browse the repository at this point in the history
Remove ballot from ElectionCandidatesTableSection
  • Loading branch information
RaduCStefanescu authored Nov 24, 2020
2 parents 5425b1a + 5e0ecfc commit 17e4c94
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 22 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@code4ro/reusable-components",
"version": "0.1.52",
"version": "0.1.53",
"description": "Component library for code4ro",
"keywords": [
"code4ro",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,3 @@
th.heading {
text-align: left;
}

.collapseButton {
margin-top: 0.5rem;
align-self: flex-end;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,12 @@
import React from "react";
import { mockCandidatesList } from "../../util/mocks";
import { ElectionCandidatesTableSection } from "./ElectionCandidatesTableSection";
import cssClasses from "./ElectionCandidatesTableSection.module.scss";

export default {
title: "Election results candidates tables section",
component: ElectionCandidatesTableSection,
};

export const SimpleExample = () => {
return (
<ElectionCandidatesTableSection
classes={cssClasses}
heading="Partid"
ballot="Camera deputatilor"
parties={mockCandidatesList}
/>
);
return <ElectionCandidatesTableSection heading="Partid" parties={mockCandidatesList} />;
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ import cssClasses from "./ElectionCandidatesTableSection.module.scss";
type Props = {
heading: string;
parties: ElectionResultsPartyCandidates[] | undefined;
ballot: string;
};

export const ElectionCandidatesTableSection = themable<Props>(
"ElectionCandidatesTableSection",
cssClasses,
)(({ heading, parties, ballot }) => (
)(({ heading, parties }) => (
<div className={cssClasses.tableContainer}>
<ResultsTable className={cssClasses.table}>
<thead>
Expand All @@ -25,7 +24,7 @@ export const ElectionCandidatesTableSection = themable<Props>(
<tbody>
{parties &&
parties.map((party, index) => (
<ElectionPartyRow key={index} name={party.name} candidates={party.candidates} ballot={ballot} />
<ElectionPartyRow key={index} name={party.name} candidates={party.candidates} />
))}
</tbody>
</ResultsTable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
position: absolute;
top: 50%;
right: 10px;
transform: translatey(-50%);

width: 0;
height: 0;
Expand Down
4 changes: 1 addition & 3 deletions src/components/ElectionPartyRow/ElectionPartyRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ import cssClasses from "./ElectionPartyRow.module.scss";

type Props = {
name: string;
ballot: string;
candidates: ElectionResultsPartyCandidate[];
};

export const ElectionPartyRow = themable<Props>(
"ElectionPartyRow",
cssClasses,
)(({ name, ballot, candidates }) => {
)(({ name, candidates }) => {
const [expanded, setExpanded] = useState<boolean>(false);

const onExpandClick = useCallback(() => {
Expand All @@ -37,7 +36,6 @@ export const ElectionPartyRow = themable<Props>(
{candidates.map((candidate: ElectionResultsPartyCandidate) => (
<tr key={candidate.name} className={cssClasses.candidate}>
<td>{candidate.name}</td>
<td>{ballot}</td>
</tr>
))}
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion src/stories/APIIntegration.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const ElectionCandidatesComponent = (args: { api: string; apiUrl: string
return (
<>
<APIRequestPreview data={data} loading={loading} error={error} />
{data && <ElectionCandidatesTableSection heading="Partid" parties={data} ballot="Senat" />}
{data && <ElectionCandidatesTableSection heading="Partid" parties={data} />}
</>
);
};

1 comment on commit 17e4c94

@vercel
Copy link

@vercel vercel bot commented on 17e4c94 Nov 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.