Skip to content

Commit

Permalink
Add falback props instead of error, implement requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
camilovegag committed Aug 5, 2024
1 parent 7fdbf50 commit 64464ca
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/berlin/src/components/cycles/Cycles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import Button from '../button';

type CyclesProps = {
cycles: GetCycleResponse[] | undefined;
errorMessage: string;
eventId: string | undefined;
tab: string;
setActiveTab: (tab: string) => void;
fallback: {
message: string;
buttonMessage: string;
buttonOnClick: () => void;
};
};

function Cycles({ cycles, errorMessage, eventId, tab, setActiveTab }: CyclesProps) {
function Cycles({ cycles, eventId, fallback }: CyclesProps) {
const navigate = useNavigate();

const formatDate = (date: string) => {
Expand Down Expand Up @@ -40,8 +42,8 @@ function Cycles({ cycles, errorMessage, eventId, tab, setActiveTab }: CyclesProp
) : (
<section className="flex w-full flex-col items-center gap-4 pt-12">
<CalendarX2 width={64} height={64} />
<Body>{errorMessage}</Body>
<Button onClick={() => setActiveTab(tab)}>{tab} questions</Button>
<Body>{fallback.message}</Body>
<Button onClick={fallback.buttonOnClick}>{fallback.buttonMessage}</Button>
</section>
)}
</>
Expand Down

0 comments on commit 64464ca

Please sign in to comment.