Skip to content

Commit

Permalink
Small theme tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
kazlauskis committed Sep 12, 2024
1 parent 478d2f0 commit 53fd9da
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ const Image = ({ media, isDisabled, onDelete, onClick }: Props) => {
{showLoading && <IonSpinner slot="end" />}

{!showLoading && hasBeenIdentified && selectedSpeciesMatch && (
<ProbabilityBadge probability={probability} />
<ProbabilityBadge
probability={probability}
className="absolute bottom-0 z-10 ml-1 rounded-lg"
/>
)}

{!showLoading && hasBeenIdentified && !selectedSpeciesMatch && (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
.photo-picker .img {
.badge {
position: absolute;
bottom: 2px;
left: 2px;
padding: 3px;
}

.warning-icon {
position: absolute;
bottom: 2px;
Expand Down
39 changes: 39 additions & 0 deletions src/Survey/common/Components/ProbabilityBadge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import clsx from 'clsx';
import { camera } from 'ionicons/icons';
import { IonIcon } from '@ionic/react';
import CONFIG from 'common/config';
import { Badge } from 'common/flumens';

interface Props {
probability?: number;
className?: string;
}

const ProbabilityBadge = ({ probability, className }: Props) => {
if (!probability) return null;

const roundedProbability = (probability * 100).toFixed();

let color;
if (probability > CONFIG.POSITIVE_THRESHOLD) {
color =
'border border-solid border-[color:var(--classifier-success)] text-[color:var(--classifier-success)] bg-[var(--classifier-success-background)]';
} else if (probability > CONFIG.POSSIBLE_THRESHOLD) {
color =
'border border-solid border-[color:var(--classifier-plausible)] bg-[var(--classifier-plausible-background)] text-[color:var(--classifier-plausible)]';
} else {
color =
'border border-solid border-[color:var(--classifier-unlikely)] bg-[var(--classifier-unlikely-background)] text-[color:var(--classifier-unlikely)]';
}

return (
<Badge
className={clsx(className, color)}
prefix={<IonIcon icon={camera} className="mr-[3px] text-[1em]" />}
>
{roundedProbability}%
</Badge>
);
};

export default ProbabilityBadge;
33 changes: 0 additions & 33 deletions src/Survey/common/Components/ProbabilityBadge/index.tsx

This file was deleted.

35 changes: 0 additions & 35 deletions src/Survey/common/Components/ProbabilityBadge/styles.scss

This file was deleted.

8 changes: 8 additions & 0 deletions src/common/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -343,3 +343,11 @@ ion-item .sc-ion-label-ios-h.sc-ion-label-ios-s.ios {
margin-top: 12px;
margin-bottom: 12px;
}

// Unify menu lines with Tailwind package components
.date-input-attr ion-accordion:last-of-type ion-item[slot='header'],
.list-ios-lines-full ion-item.item-lines-default,
.list-md-lines-full ion-item.item-lines-default {
--border-width: 0 0 0.5px 0 !important;
--border-color: #e5e5e5 !important;
}

0 comments on commit 53fd9da

Please sign in to comment.