-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Cuong Vu
authored
Jun 4, 2020
1 parent
2b49b19
commit 12a2c56
Showing
20 changed files
with
359 additions
and
28 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
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
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
37 changes: 37 additions & 0 deletions
37
...rc/components/ui/client-app-detail/__test__/__snapshots__/client-app-header.test.tsx.snap
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,37 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`ClientAppHeader should match a snapshot 1`] = ` | ||
<div> | ||
<div | ||
className="flex mb-3 undefined" | ||
> | ||
<div | ||
style={ | ||
Object { | ||
"backgroundImage": "url('https://reapit-app-store-app-media.s3.eu-west-2.amazonaws.com/7d88729f-2366-4561-9d5c-282615f3946b.jpeg')", | ||
} | ||
} | ||
/> | ||
<div> | ||
<Component> | ||
Peter's Properties | ||
</Component> | ||
<div> | ||
<FaCheck /> | ||
Verified by Reapit Ltd | ||
</div> | ||
</div> | ||
</div> | ||
<div /> | ||
<div> | ||
<img | ||
src="https://reapit-app-store-app-media.s3.eu-west-2.amazonaws.com/c4a36706-aa44-47f9-9fb6-9053eef4e581.png" | ||
style={ | ||
Object { | ||
"height": "auto", | ||
} | ||
} | ||
/> | ||
</div> | ||
</div> | ||
`; |
17 changes: 17 additions & 0 deletions
17
packages/marketplace/src/components/ui/client-app-detail/__test__/client-app-header.test.tsx
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,17 @@ | ||
import * as React from 'react' | ||
import { shallow } from 'enzyme' | ||
import { appDetailDataStub } from '@/sagas/__stubs__/app-detail' | ||
import ClientAppHeader, { ClientAppHeaderProps } from '../client-app-header' | ||
|
||
const mockProps: ClientAppHeaderProps = { | ||
appDetailData: { | ||
...appDetailDataStub.data, | ||
apiKey: '', | ||
}, | ||
} | ||
|
||
describe('ClientAppHeader', () => { | ||
it('should match a snapshot', () => { | ||
expect(shallow(<ClientAppHeader {...mockProps} />)).toMatchSnapshot() | ||
}) | ||
}) |
47 changes: 47 additions & 0 deletions
47
packages/marketplace/src/components/ui/client-app-detail/client-app-header.tsx
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,47 @@ | ||
import * as React from 'react' | ||
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 & { | ||
apiKey?: string | undefined | ||
} | ||
buttonGroup?: React.ReactNode | ||
} | ||
|
||
const ClientAppHeader: React.FC<ClientAppHeaderProps> = ({ appDetailData, buttonGroup }) => { | ||
const { media } = appDetailData | ||
const appIcon = media?.filter(({ type }) => type === 'icon')[MEDIA_INDEX.ICON] | ||
const featureImageSrc = appDetailData?.media?.[MEDIA_INDEX.FEATURE_IMAGE]?.uri | ||
const isHaveFeatureImage = !!featureImageSrc | ||
|
||
return ( | ||
<div className={styles.appHeader}> | ||
<div className={`flex mb-3 ${styles.titleContainer}`}> | ||
<div className={styles.appIconContainer} style={{ backgroundImage: `url('${appIcon?.uri}')` }}></div> | ||
<div className={styles.appHeaderTextContainer}> | ||
<H2 className={styles.appName}>{appDetailData.name}</H2> | ||
<div className={styles.verifyByReapitContainer}> | ||
<FaCheck className={styles.check} /> Verified by Reapit Ltd | ||
</div> | ||
{buttonGroup} | ||
</div> | ||
</div> | ||
|
||
<div className={styles.separator} /> | ||
|
||
<div className={styles.appHeaderFeaturedImageContainer}> | ||
<img | ||
className={styles.appHeaderFeaturedImage} | ||
src={featureImageSrc} | ||
style={{ height: isHaveFeatureImage ? 'auto' : '20rem' }} | ||
/> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default ClientAppHeader |
1 change: 1 addition & 0 deletions
1
packages/marketplace/src/components/ui/standalone-app-detail/app-header.tsx
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,4 @@ | ||
export const MEDIA_INDEX = { | ||
ICON: 0, | ||
FEATURE_IMAGE: 1, | ||
} |
Oops, something went wrong.