-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bcb08bb
commit 4211c22
Showing
7 changed files
with
112 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"namespace": "source card", | ||
"namespace": "sourceCard", | ||
"strings": { | ||
"languageTitle":"language", | ||
"sourceCardLastUpdated":"Date" | ||
"sourceCardAlt": "Logo" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,43 @@ | ||
import { | ||
Button, | ||
Container, | ||
Header, | ||
} from '@ifrc-go/ui'; | ||
import { useTranslation } from '@ifrc-go/ui/hooks'; | ||
|
||
import { SourceFeedsQuery } from '#generated/types'; | ||
|
||
import i18n from './i18n.json'; | ||
import styles from './styles.module.css'; | ||
|
||
interface Props { | ||
className?: string; | ||
} | ||
type SourceFeed = NonNullable<NonNullable<SourceFeedsQuery['public']>['feeds']>['items'][number]; | ||
|
||
interface FeedsData { | ||
logo: string; | ||
name: string; | ||
language: string; | ||
} | ||
interface Props { | ||
className?: string; | ||
feedsData: FeedsData; | ||
data: SourceFeed; | ||
} | ||
function SourceCard(props: Props) { | ||
const { className, feedsData } = props; | ||
|
||
if (!feedsData || !feedsData.logo) { | ||
return null; | ||
} | ||
function SourceCard(props: Props) { | ||
const { | ||
data, | ||
} = props; | ||
|
||
const strings = useTranslation(i18n); | ||
return ( | ||
<Container | ||
className={(styles.sourceCard, className)} | ||
heading={( | ||
<div className={styles.feedCart}> | ||
<div className={styles.flexContainer}> | ||
<img src={feedsData.logo} alt="Logo" className={styles.figure} /> | ||
<div className={styles.separator} /> | ||
<div> | ||
<p className={styles.severityIndicator}>{feedsData.name}</p> | ||
<Button | ||
className={styles.languageButton} | ||
variant="primary" | ||
name={feedsData.language} | ||
> | ||
{feedsData.language} | ||
</Button> | ||
</div> | ||
</div> | ||
</div> | ||
)} | ||
/> | ||
className={styles.sourceCard} | ||
childrenContainerClassName={styles.sourceDetail} | ||
> | ||
<img | ||
className={styles.figure} | ||
src={data.logo} | ||
alt={strings.sourceCardAlt} | ||
/> | ||
<Header | ||
heading={data.name} | ||
headingLevel={5} | ||
headingDescriptionContainerClassName={styles.languageButton} | ||
headingDescription={data.language} | ||
/> | ||
</Container> | ||
); | ||
} | ||
export default SourceCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,28 @@ | ||
.flexContainer { | ||
display: flex; | ||
gap: var(--go-ui-spacing-sm) var(--go-ui-spacing-lg); | ||
align-items: center; | ||
margin:2%; | ||
.source-card { | ||
display: flex; | ||
gap:var(--go-ui-spacing-lg); | ||
} | ||
|
||
.source-detail { | ||
display: flex; | ||
gap:var(--go-ui-spacing-lg); | ||
border-radius: var(--go-ui-border-radius-lg); | ||
box-shadow: var(--go-ui-box-shadow-md); | ||
padding: var(--go-ui-spacing-md) var(--go-ui-spacing-lg); | ||
|
||
.severity-indicator { | ||
gap: var(--go-ui-spacing-sm) var(--go-ui-spacing-lg); | ||
} | ||
padding: var(--go-ui-spacing-md); | ||
|
||
.last-updated { | ||
color: var(--go-ui-color-text-light); | ||
.language-button { | ||
align-items: flex-end; | ||
border-radius: var(--go-ui-border-radius-2xl); | ||
background-color: var(--go-ui-color-primary-red); | ||
padding: var(--go-ui-spacing-4xs) var(--go-ui-spacing-lg); | ||
width: fit-content; | ||
text-decoration: none; | ||
color: var(--go-ui-color-white); | ||
font-weight: var(--go-ui-font-weight-medium); | ||
} | ||
|
||
.figures { | ||
gap: var(--go-ui-spacing-sm) var(--go-ui-spacing-sm); | ||
justify-content: center; | ||
|
||
.figure { | ||
flex-basis: 0; | ||
flex-grow: 1; | ||
padding: 0; | ||
} | ||
.figure { | ||
width: 10rem; | ||
height: 4rem; | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.sources-list { | ||
display: grid; | ||
grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); | ||
grid-gap: var(--go-ui-spacing-md); | ||
} |