Skip to content

Commit

Permalink
fix: #1468 add constants for media
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuong Vu committed Jun 4, 2020
1 parent b3fb820 commit cbc3f04
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { H2 } from '@reapit/elements'
import { FaCheck } from 'react-icons/fa'
import { AppDetailModel } from '@reapit/foundations-ts-definitions'
import styles from '@/styles/blocks/client-app-header.scss?mod'
import { MEDIA_INDEX } from '@/constants/media'

export type ClientAppHeaderProps = {
appDetailData: AppDetailModel & {
Expand All @@ -13,8 +14,8 @@ export type ClientAppHeaderProps = {

const ClientAppHeader: React.FC<ClientAppHeaderProps> = ({ appDetailData, buttonGroup }) => {
const { media } = appDetailData
const appIcon = media?.filter(({ type }) => type === 'icon')[0]
const featureImageSrc = appDetailData?.media?.[1]?.uri
const appIcon = media?.filter(({ type }) => type === 'icon')[MEDIA_INDEX.ICON]
const featureImageSrc = appDetailData?.media?.[MEDIA_INDEX.FEATURE_IMAGE]?.uri

return (
<div className={styles.appHeader}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO: remove this file after we separated dev & client standalone page
import * as React from 'react'
import { H2 } from '@reapit/elements'
import { FaCheck } from 'react-icons/fa'
Expand Down
4 changes: 4 additions & 0 deletions packages/marketplace/src/constants/media.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const MEDIA_INDEX = {
ICON: 0,
FEATURE_IMAGE: 1,
}
2 changes: 1 addition & 1 deletion packages/marketplace/src/tests/badges/badge-branches.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/marketplace/src/tests/badges/badge-functions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/marketplace/src/tests/badges/badge-lines.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/marketplace/src/tests/badges/badge-statements.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cbc3f04

Please sign in to comment.