-
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.
chore: adding header example on non virtualized list (#52)
- Loading branch information
Showing
3 changed files
with
90 additions
and
7 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,68 @@ | ||
/* eslint-disable no-console */ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
import { Button } from '../../../design-system/components/Button'; | ||
import { Typography } from '../../../design-system/components/Typography'; | ||
import { SpatialNavigationNode } from 'react-tv-space-navigation'; | ||
import { Spacer } from '../../../design-system/components/Spacer'; | ||
import { Image } from 'react-native'; | ||
import styled from '@emotion/native'; | ||
|
||
interface HeaderProps { | ||
title: string; | ||
description: string; | ||
verticalSize: number; | ||
} | ||
|
||
const imageSource = require('../assets/rabbitLarge.png'); | ||
|
||
export const Header = ({ title, description, verticalSize }: HeaderProps) => { | ||
return ( | ||
<SpatialNavigationNode orientation="horizontal"> | ||
<Container height={verticalSize}> | ||
<InformationContainer> | ||
<Typography variant="title">{title}</Typography> | ||
<Spacer gap={'$6'} /> | ||
<Descritption variant="body">{description}</Descritption> | ||
<ButtonContainer> | ||
<Button label="Play random" onSelect={() => console.log('Randomed!')} /> | ||
<Button label="Add to favorites" onSelect={() => console.log('Favorited!')} /> | ||
</ButtonContainer> | ||
</InformationContainer> | ||
<ImageContainer> | ||
<ProgramImage source={imageSource} /> | ||
</ImageContainer> | ||
</Container> | ||
</SpatialNavigationNode> | ||
); | ||
}; | ||
|
||
const InformationContainer = styled.View({ | ||
width: '48%', | ||
}); | ||
|
||
const ButtonContainer = styled.View(({ theme }) => ({ | ||
flexDirection: 'row', | ||
gap: theme.spacings.$6, | ||
})); | ||
|
||
const ImageContainer = styled.View({ | ||
width: '48%', | ||
}); | ||
|
||
const Descritption = styled(Typography)({ | ||
flex: 1, | ||
}); | ||
|
||
const Container = styled.View<{ height: number }>(({ height, theme }) => ({ | ||
height: height, | ||
flexDirection: 'row', | ||
justifyContent: 'space-between', | ||
padding: theme.spacings.$6, | ||
})); | ||
|
||
const ProgramImage = styled(Image)({ | ||
width: '100%', | ||
height: '100%', | ||
objectFit: 'cover', | ||
borderRadius: 20, | ||
}); |
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