Skip to content

Commit

Permalink
Subscription styling
Browse files Browse the repository at this point in the history
  • Loading branch information
barshathakuri committed Dec 4, 2024
1 parent 9bb3e12 commit 41a98fe
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 50 deletions.
97 changes: 64 additions & 33 deletions src/views/MySubscription/SubscriptionTableItem/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {
Chip,
Container,
NumberOutput,
TextOutput,
} from '@ifrc-go/ui';
import { useTranslation } from '@ifrc-go/ui/hooks';
Expand Down Expand Up @@ -40,77 +42,106 @@ function SubscriptionTableItem(props: Props) {

return (
<Container
key={id}
className={styles.subscriptionDetail}
heading={name}
headingLevel={3}
withInternalPadding
headingDescription={(
<NumberOutput
prefix="("
value={alertCount}
suffix=")"
/>
)}
actions={(
<>
(
{alertCount}
)
<Link
to="subscriptionDetail"
urlParams={{
subscriptionId: id,
}}
variant="secondary"
>
{strings.subscriptionItemView}
</Link>
{actions}
</>
)}
footerContentClassName={styles.alertDetail}
footerContent={(
<>
childrenContainerClassName={styles.content}
>
<Chip
name={undefined}
variant="tertiary"
className={styles.filterItem}
label={(

Check failure on line 76 in src/views/MySubscription/SubscriptionTableItem/index.tsx

View workflow job for this annotation

GitHub Actions / Typecheck

Type 'Element' is not assignable to type 'string'.
<TextOutput
className={styles.label}
label={strings.subscriptionCountry}
value={filterAlertCountry}
strongLabel
withoutLabelColon
/>
)}
/>
<Chip
name={undefined}
variant="tertiary"
className={styles.filterItem}
label={(

Check failure on line 88 in src/views/MySubscription/SubscriptionTableItem/index.tsx

View workflow job for this annotation

GitHub Actions / Typecheck

Type 'Element' is not assignable to type 'string'.
<TextOutput
className={styles.label}
label={strings.subscriptionAdmin1}
value={filterAlertAdmin1s.join(', ')}
strongLabel
withoutLabelColon
/>
)}
/>
<Chip
name={undefined}
variant="tertiary"
className={styles.filterItem}
label={(

Check failure on line 100 in src/views/MySubscription/SubscriptionTableItem/index.tsx

View workflow job for this annotation

GitHub Actions / Typecheck

Type 'Element' is not assignable to type 'string'.
<TextOutput
className={styles.label}
label={strings.subscriptionUrgency}
value={filterAlertUrgencies.join(', ')}
strongLabel
withoutLabelColon
/>
)}
/>
<Chip
name={undefined}
variant="tertiary"
className={styles.filterItem}
label={(

Check failure on line 112 in src/views/MySubscription/SubscriptionTableItem/index.tsx

View workflow job for this annotation

GitHub Actions / Typecheck

Type 'Element' is not assignable to type 'string'.
<TextOutput
className={styles.label}
label={strings.subscriptionCertainty}
value={filterAlertCertainties.join(', ')}
strongLabel
withoutLabelColon
/>
)}
/>
<Chip
name={undefined}
variant="tertiary"
className={styles.filterItem}
label={(

Check failure on line 124 in src/views/MySubscription/SubscriptionTableItem/index.tsx

View workflow job for this annotation

GitHub Actions / Typecheck

Type 'Element' is not assignable to type 'string'.
<TextOutput
className={styles.label}
label={strings.subscriptionSeverity}
value={filterAlertSeverities.join(', ')}
strongLabel
withoutLabelColon
/>
)}
/>
<Chip
name={undefined}
variant="tertiary"
className={styles.filterItem}
label={(

Check failure on line 136 in src/views/MySubscription/SubscriptionTableItem/index.tsx

View workflow job for this annotation

GitHub Actions / Typecheck

Type 'Element' is not assignable to type 'string'.
<TextOutput
className={styles.label}
label={strings.subscriptionCategory}
value={filterAlertCategories.join(', ')}
strongLabel
withoutLabelColon
/>
</>
)}
footerActions={(
<Link
to="subscriptionDetail"
urlParams={{
subscriptionId: id,
}}
variant="secondary"
>
{strings.subscriptionItemView}
</Link>
)}
/>
)}
/>
</Container>
);
}

Expand Down
17 changes: 8 additions & 9 deletions src/views/MySubscription/SubscriptionTableItem/styles.module.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
.subscription-detail {
background-color: var(--go-ui-color-gray-20);
padding: var(--go-ui-spacing-md);
background-color: var(--go-ui-color-background);
border-radius: var(--go-ui-border-radius-lg);

.alertDetail {
.content {
display: flex;
gap: var(--go-ui-spacing-xs);
flex-wrap: wrap;
gap: var(--go-ui-spacing-xl);
}

.label {
display: flex;
flex-direction: column;
.filter-item {
font-size: var(--go-ui-font-size-xs);
}
}
}
}
6 changes: 3 additions & 3 deletions src/views/NewSubscriptionModal/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"filterRegionsPlaceholder": "All Regions",
"newSubscriptionHeading": "New Subscription",
"newSubscriptionTitle": "Title",
"newSubscriptionCreatedSucessfully": "Subscription created successfully.",
"newSubscriptionCreatedSuccessfully": "Subscription created successfully.",
"newSubscriptionFailed": "Failed to create subscription",
"newSubscriptionLimitExceed": "You have reached the maximum limit of 10 subscriptions",
"newSubscriptionLimitExceeded": "You have reached the maximum limit of 10 subscriptions",
"subscriptionUpdatedSuccessfully": "Subscription updated successfully.",
"failedToUpdateSubscription": "Failed to update subscription."
}
}
}
9 changes: 4 additions & 5 deletions src/views/NewSubscriptionModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,10 @@ function NewSubscriptionModal(props: Props) {
if (!response) {
return;
}

if (response.ok) {
alert.show(
strings.newSubscriptionCreatedSucessfully,
strings.newSubscriptionCreatedSuccessfully,
{ variant: 'success' },
);
onCloseModal();
Expand All @@ -319,7 +320,7 @@ function NewSubscriptionModal(props: Props) {
}
} else {
alert.show(
strings.newSubscriptionFailed,
strings.newSubscriptionLimitExceeded,
{ variant: 'danger' },
);
}
Expand Down Expand Up @@ -421,9 +422,7 @@ function NewSubscriptionModal(props: Props) {
},
}).then(() => {
if (onSuccess) {
(
onSuccess()
);
onSuccess();
}
});
} else {
Expand Down

0 comments on commit 41a98fe

Please sign in to comment.