react-icons/fa#FaChevronLeft TypeScript Examples
The following examples show how to use
react-icons/fa#FaChevronLeft.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.tsx From netflix-clone with GNU General Public License v3.0 | 5 votes |
SectionMovies: React.FC<SectionMoviesProps> = ({ name, movies }) => {
const [marginContent, setMarginContent] = useState(0);
const MAX_WIDTH_CONTENT = useMemo(() => movies.length * 220, [movies]);
const handleScrollMovies = useCallback(
direction => {
setMarginContent(stateMargin => {
const newValue = stateMargin + (direction === 'left' ? -400 : 400);
const isError =
MAX_WIDTH_CONTENT + newValue < window.innerWidth || newValue === 400;
return isError ? stateMargin : newValue;
});
},
[MAX_WIDTH_CONTENT],
);
return (
<Container>
<h1>{name}</h1>
<ButtonLetf type="button" onClick={() => handleScrollMovies('right')}>
<FaChevronLeft />
</ButtonLetf>
<ContentMovies
style={{ marginLeft: marginContent, width: MAX_WIDTH_CONTENT }}
>
{movies.map(movie => (
<Movie key={movie.id}>
<img
src={`https://image.tmdb.org/t/p/w300${movie.poster_path}`}
alt={`Capa do filme/seriado ${movie.name}`}
/>
<MovieCard>
<strong>{movie.name || movie.title}</strong>
<p>{movie.overview}</p>
<MovieCardControll>
<button type="button">
<FaPlay /> Assistir
</button>
<span>
<FaPlus />
</span>
<span>
<FaThumbsUp />
</span>
<span>
<FaThumbsDown />
</span>
</MovieCardControll>
</MovieCard>
</Movie>
))}
</ContentMovies>
<ButtonRight type="button" onClick={() => handleScrollMovies('left')}>
<FaChevronRight />
</ButtonRight>
</Container>
);
}
Example #2
Source File: Proposal.tsx From dxvote with GNU Affero General Public License v3.0 | 4 votes |
ProposalPage: React.FC = () => {
const {
chain_name: chainName,
guild_id: guildId,
proposal_id: proposalId,
} = useParams<{
chain_name: string;
guild_id?: string;
proposal_id?: string;
}>();
const { isLoading: isGuildAvailabilityLoading } = useContext(
GuildAvailabilityContext
);
const { data: proposalIds } = useGuildProposalIds(guildId);
const { data: proposal, error } = useProposal(guildId, proposalId);
const { options } = useProposalCalls(guildId, proposalId);
if (!isGuildAvailabilityLoading) {
if (!proposalIds?.includes(proposalId)) {
return (
<Result
state={ResultState.ERROR}
title="We couldn't find that proposal."
subtitle="It probably doesn't exist."
extra={
<UnstyledLink to={`/${chainName}/${guildId}`}>
<IconButton iconLeft>
<FiArrowLeft /> See all proposals
</IconButton>
</UnstyledLink>
}
/>
);
} else if (error) {
return (
<Result
state={ResultState.ERROR}
title="We ran into an error."
subtitle={error.message}
/>
);
}
}
return (
<PageContainer>
<PageContent>
<PageHeader>
<HeaderTopRow>
<UnstyledLink to={`/${chainName}/${guildId}`}>
<StyledIconButton variant="secondary" iconLeft>
<FaChevronLeft style={{ marginRight: '15px' }} /> DXdao
</StyledIconButton>
</UnstyledLink>
<ProposalStatusWrapper>
<ProposalStatus proposalId={proposalId} showRemainingTime />
</ProposalStatusWrapper>
</HeaderTopRow>
<PageTitle>
{proposal?.title || (
<Loading loading text skeletonProps={{ width: '800px' }} />
)}
</PageTitle>
</PageHeader>
<AddressButton address={proposal?.creator} />
<ProposalDescription />
<ProposalActionsWrapper>
<ActionsBuilder options={options} editable={false} />
</ProposalActionsWrapper>
</PageContent>
<SidebarContent>
<ProposalVoteCard />
<ProposalInfoCard />
</SidebarContent>
</PageContainer>
);
}
Example #3
Source File: index.tsx From pokedex with MIT License | 4 votes |
Pokemon: React.FC = () => { const { colors } = useTheme(); const { name } = useParams() as RouteParams; const [nameSectionActive, setNameSectionActive] = useState('about'); const [pokemon, setPokemon] = useState({} as PokemonProps); const [backgroundColor, setBackgroundColor] = useState< keyof typeof pokemonTypes >('normal'); useEffect(() => { api.get(`/pokemon/${name}`).then(response => { const { id, weight, height, stats, sprites, types, species, } = response.data; setBackgroundColor(types[0].type.name); if (types[0].type.name === 'normal' && types.length > 1) { setBackgroundColor(types[1].type.name); } setPokemon({ id, number: `#${'000'.substr(id.toString().length)}${id}`, image: sprites.other['official-artwork'].front_default || sprites.front_default, weight: `${weight / 10} kg`, specie: species.name, height: `${height / 10} m`, stats: { hp: stats[0].base_stat, attack: stats[1].base_stat, defense: stats[2].base_stat, specialAttack: stats[3].base_stat, specialDefense: stats[4].base_stat, speed: stats[5].base_stat, }, type: types.map((pokemonType: TypePokemonResponse) => ({ name: pokemonType.type.name, icon: pokemonTypes[pokemonType.type.name], color: colors.type[pokemonType.type.name], })), }); }); }, [name, colors]); const screenSelected = useMemo(() => { const color = colors.type[backgroundColor]; switch (nameSectionActive) { case 'about': return <About pokemon={pokemon} colorText={color} />; case 'stats': return pokemon.stats && <Stats stats={pokemon.stats} color={color} />; case 'evolution': return <Evolution name={name} color={color} />; default: return <></>; } }, [nameSectionActive, colors, backgroundColor, pokemon, name]); return ( <Container color={colors.backgroundType[backgroundColor]}> <GoBack to="/"> <FaChevronLeft size={50} /> </GoBack> <BackgroundNamePokemon> <h1>{name}</h1> </BackgroundNamePokemon> <Content> <Header> <img src={pokemon.image} alt={`Imagem do pokémon ${name}`} /> <PokemonLoader colorBackground={colors.backgroundType[backgroundColor]} colorType="rgba(255,255,255,0.6)" > <span /> </PokemonLoader> {/* <PokemonCircle color={colors.backgroundType[backgroundColor]} /> */} <div> <PokemonNumber>{pokemon.number}</PokemonNumber> <PokemonName>{name}</PokemonName> {pokemon.type && ( <div> {pokemon.type.map(pokemonType => ( <PokemonType color={pokemonType.color} key={pokemonType.name}> {pokemonType.icon} <span>{pokemonType.name}</span> </PokemonType> ))} </div> )} </div> </Header> <SectionsName> {['about', 'stats', 'evolution'].map(nameSection => ( <SectionsNameButton key={nameSection} type="button" onClick={() => setNameSectionActive(nameSection)} active={nameSection === nameSectionActive} > {nameSection} {nameSection === nameSectionActive && <Pokeball />} </SectionsNameButton> ))} </SectionsName> <ContentSection>{screenSelected}</ContentSection> </Content> </Container> ); }