react-icons/fi#FiChevronLeft TypeScript Examples
The following examples show how to use
react-icons/fi#FiChevronLeft.
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 github-explorer with MIT License | 6 votes |
function RepositoryDetailsLayoutHeader() {
const [t] = useTranslation();
return (
<Header>
<Link to="/">
<FiChevronLeft size={16} />
{t("buttons.back")}
</Link>
</Header>
);
}
Example #2
Source File: Login.tsx From tobira with Apache License 2.0 | 6 votes |
BackButton: React.FC = () => {
const { t } = useTranslation();
// This link does `window.history.back()`. If there is nothing to go back
// to, the call will silently do nothing. In that case, the link is taken,
// bringing the user to the home page.
return <Link
to="/"
onClick={() => window.history.back()}
css={{
cursor: "pointer",
display: "flex",
alignItems: "center",
gap: 4,
}}
><FiChevronLeft />{t("back")}</Link>;
}
Example #3
Source File: index.tsx From tobira with Apache License 2.0 | 6 votes |
PageNavigation: React.FC<PageNavigationProps> = ({ connection, vars }) => {
const { t } = useTranslation();
const pageInfo = connection.pageInfo;
return (
<div css={{
display: "flex",
justifyContent: "end",
alignItems: "center",
gap: 48,
}}>
<div>
{t("manage.my-videos.page-showing-video-ids", {
start: connection.pageInfo.startIndex ?? "?",
end: connection.pageInfo.endIndex ?? "?",
total: connection.totalCount,
})}
</div>
<div>
<PageLink
vars={{ order: vars.order, first: LIMIT }}
disabled={!pageInfo.hasPreviousPage && connection.items.length === LIMIT}
><FirstPage /></PageLink>
<PageLink
vars={{ order: vars.order, before: pageInfo.startCursor, last: LIMIT }}
disabled={!pageInfo.hasPreviousPage}
><FiChevronLeft /></PageLink>
<PageLink
vars={{ order: vars.order, after: pageInfo.endCursor, first: LIMIT }}
disabled={!pageInfo.hasNextPage}
><FiChevronRight /></PageLink>
<PageLink
vars={{ order: vars.order, last: LIMIT }}
disabled={!pageInfo.hasNextPage}
><LastPage /></PageLink>
</div>
</div>
);
}
Example #4
Source File: Navigation.tsx From tobira with Apache License 2.0 | 5 votes |
Nav: React.FC<Props> = ({ fragRef }) => {
const { t, i18n } = useTranslation();
const realm = useFragment(
graphql`
fragment NavigationData on Realm {
id
name
childOrder
children { id name path }
parent {
isRoot
name
path
}
}
`,
fragRef,
);
const children = [...realm.children];
match(realm.childOrder, {
"ALPHABETIC_ASC": () => {
children.sort((a, b) => a.name.localeCompare(b.name, i18n.language));
},
"ALPHABETIC_DESC": () => {
children.sort((a, b) => b.name.localeCompare(a.name, i18n.language));
},
}, () => {});
return <nav>
{realm.parent !== null && <>
<LinkWithIcon
to={realm.parent.path}
iconPos="left"
css={{
padding: "6px 4px",
[`@media not all and (max-width: ${BREAKPOINT}px)`]: {
borderRadius: `${SIDE_BOX_BORDER_RADIUS}px ${SIDE_BOX_BORDER_RADIUS}px 0 0`,
},
...FOCUS_STYLE_INSET,
}}
>
<FiChevronLeft css={{ marginRight: "8px !important" }}/>
{realm.parent.isRoot ? t("home") : realm.parent.name}
</LinkWithIcon>
<div css={{
padding: 12,
paddingLeft: 4 + 22 + 8,
fontWeight: "bold",
backgroundColor: "var(--nav-color-dark)",
color: "var(--nav-color-bw-contrast)",
border: "2px solid white",
borderLeft: "none",
borderRight: "none",
}}>{realm.name}</div>
</>}
<LinkList
items={children.map(child => (
<Item
key={child.id}
label={child.name}
link={child.path}
/>
))}
css={{
"& > li > ": {
paddingRight: 6,
paddingLeft: realm.parent != null ? 4 + 22 + 8 : 16,
},
}}
/>
</nav>;
}
Example #5
Source File: UserBox.tsx From tobira with Apache License 2.0 | 5 votes |
Menu: React.FC<MenuProps> = ({ close, container }) => {
const { t } = useTranslation();
type State = "main" | "language";
const [state, setState] = useState<State>("main");
const userState = useUser();
const user = userState === "none" || userState === "unknown" ? null : userState;
// Close menu on clicks anywhere outside of it.
useOnOutsideClick(container, close);
const items = match(state, {
main: () => <>
{/* Login button if the user is NOT logged in */}
{!user && (
<MenuItem
icon={<FiLogIn />}
borderBottom
linkTo={CONFIG.auth.loginLink ?? LOGIN_PATH}
htmlLink={!!CONFIG.auth.loginLink}
css={{
color: "var(--nav-color)",
[`@media not all and (max-width: ${BREAKPOINT_MEDIUM}px)`]: {
display: "none",
},
}}
>{t("user.login")}</MenuItem>
)}
{user && <>
{user.canUpload && <MenuItem
icon={<FiUpload />}
linkTo={"/~upload"}
onClick={() => close()}
>{t("upload.title")}</MenuItem>}
<MenuItem
icon={<FiFilm />}
linkTo="/~manage"
onClick={() => close()}
>{t("user.manage-content")}</MenuItem>
</>}
<MenuItem icon={<HiOutlineTranslate />} onClick={() => setState("language")}>
{t("language")}
</MenuItem>
{/* Logout button if the user is logged in */}
{user && <Logout />}
</>,
language: () => <>
<MenuItem icon={<FiChevronLeft />} onClick={() => setState("main")} borderBottom>
{t("back")}
</MenuItem>
<LanguageMenu />
</>,
});
return (
<ul css={{
position: "absolute",
zIndex: 1000,
top: "100%",
right: 8,
marginTop: 8,
borderRadius: 4,
border: "1px solid var(--grey80)",
boxShadow: "1px 1px 5px var(--grey92)",
backgroundColor: "white",
minWidth: 200,
paddingLeft: 0,
margin: 0,
overflow: "hidden",
}}>{items}</ul>
);
}
Example #6
Source File: styles.ts From vagasExplorer with MIT License | 5 votes |
IconBack = styled(FiChevronLeft).attrs({
size: 16,
})``
Example #7
Source File: CreateProposal.tsx From dxvote with GNU Affero General Public License v3.0 | 4 votes |
CreateProposalPage: React.FC = () => {
const { isLoading: isGuildAvailabilityLoading } = useContext(
GuildAvailabilityContext
);
const ttlMs = 345600000;
const history = useHistory();
const [editMode, setEditMode] = useState(true);
const [title, setTitle] = useState('');
const [referenceLink, setReferenceLink] = useState('');
const [options, setOptions] = useState<Option[]>([]);
const [proposalBodyHTML, setProposalBodyHTML] =
useLocalStorageWithExpiry<string>(
`guild/newProposal/description/html`,
null,
ttlMs
);
const [proposalBodyMd, setProposalBodyMd] = useLocalStorageWithExpiry<string>(
`guild/newProposal/description/md`,
null,
ttlMs
);
const handleToggleEditMode = () => {
// TODO: add proper validation if toggle from edit to preview without required fields
if (editMode && !title.trim() && !proposalBodyMd.trim()) return;
setEditMode(v => !v);
};
const handleBack = () => history.push('/');
const ipfs = useIPFSNode();
const uploadToIPFS = async () => {
const content = { description: proposalBodyHTML, url: referenceLink };
const cid = await ipfs.add(JSON.stringify(content));
await ipfs.pin(cid);
return contentHash.fromIpfs(cid);
};
const { createTransaction } = useTransactions();
const { guild_id: guildAddress } = useParams<{ guild_id?: string }>();
const guildContract = useERC20Guild(guildAddress);
const handleCreateProposal = async () => {
const contentHash = await uploadToIPFS();
const encodedOptions = bulkEncodeCallsFromOptions(options);
const totalActions = encodedOptions.length;
const maxActionsPerOption = encodedOptions.reduce(
(acc, cur) => (acc < cur.actions.length ? cur.actions.length : acc),
0
);
const calls = encodedOptions
.map(option => {
const actions = option.actions;
if (option.actions.length < maxActionsPerOption) {
// Pad array with empty calls
return actions.concat(
Array(maxActionsPerOption - option.actions.length).fill(EMPTY_CALL)
);
} else {
return actions;
}
})
.reduce((acc, actions) => acc.concat(actions), [] as Call[]);
const toArray = calls.map(call => call.to);
const dataArray = calls.map(call => call.data);
const valueArray = calls.map(call => call.value);
createTransaction(`Create proposal ${title}`, async () => {
return guildContract.createProposal(
toArray,
dataArray,
valueArray,
totalActions,
title,
`0x${contentHash}`
);
});
};
const isValid = useMemo(() => {
if (!title) return false;
if (!proposalBodyHTML) return false;
return true;
}, [title, proposalBodyHTML]);
if (isGuildAvailabilityLoading) return <Loading loading />;
return (
<PageContainer>
<PageContent>
<Flex
direction="row"
justifyContent="space-between"
margin="0px 0px 24px"
>
<StyledButton iconLeft onClick={handleBack}>
<FiChevronLeft />
Change proposal type
</StyledButton>
<StyledButton
padding="8px"
onClick={handleToggleEditMode}
disabled={!title || !proposalBodyMd}
data-testId="create-proposal-editor-toggle-button"
>
{editMode ? (
<MdOutlinePreview size={18} />
) : (
<MdOutlineModeEdit size={18} />
)}
</StyledButton>
</Flex>
<Box margin="0px 0px 24px">
{editMode ? (
<>
<Label>Title</Label>
<Input
data-testId="create-proposal-title"
placeholder="Proposal Title"
value={title}
onChange={e => setTitle(e.target.value)}
/>
</>
) : (
<Label size="24px"> {title}</Label>
)}
</Box>
<Box margin="0px 0px 24px">
{editMode ? (
<>
<Label>Reference link (optional)</Label>
<InputWrapper>
<Input
placeholder="https://daotalk.org/..."
value={referenceLink}
onChange={e => setReferenceLink(e.target.value)}
icon={<MdLink size={18} />}
data-testId="create-proposal-link"
/>
<StyledButton variant="secondary" marginLeft={'1rem'}>
Import
</StyledButton>
</InputWrapper>
</>
) : referenceLink ? (
<>
<Label size="16px">{referenceLink}</Label>
<StyledButton> Import </StyledButton>
</>
) : null}
</Box>
{editMode ? (
<Editor
onMdChange={setProposalBodyMd}
onHTMLChange={setProposalBodyHTML}
content={proposalBodyHTML}
placeholder="What do you want to propose?"
/>
) : (
<div
dangerouslySetInnerHTML={{ __html: sanitizeHtml(proposalBodyHTML) }}
/>
)}
<Box margin="16px 0px 24px">
<ActionsBuilder
options={options}
onChange={setOptions}
editable={editMode}
/>
</Box>
<Box margin="16px 0px">
<StyledButton
onClick={handleCreateProposal}
variant="secondary"
disabled={!isValid}
data-testId="create-proposal-action-button"
>
Create Proposal
</StyledButton>
</Box>
</PageContent>
<SidebarContent>
<SidebarInfoCard />
</SidebarContent>
</PageContainer>
);
}
Example #8
Source File: index.tsx From react-pdv with MIT License | 4 votes |
Dashboard: React.FC = () => {
const [products, setProducts] = useState<Product[]>([]);
const dispatch = useDispatch();
useEffect(() => {
async function loadProducts() {
const response = await api.get<Product[]>(
'/products',
);
const data = response.data.map((product) => ({
...product,
priceFormatted: formatPrice(product.price),
}));
setProducts(data);
}
loadProducts();
}, []);
function handleAddProduct(product: Product) {
dispatch({ type: 'ADD_TO_CART', payload: product });
}
return (
<Layout>
<s.Header>
<s.Title>Painel</s.Title>
<s.Info>
<span className="cashier">
CAIXA ABERTO
</span>
<span className="date">
Sexta, 10 julho 2020
</span>
</s.Info>
</s.Header>
<s.CardContainer>
<s.Card>
<header>
<p>Dinheiro</p>
<FiDollarSign size="24px" color="green" />
</header>
<section>
<p>R$</p>
<h1>0,00</h1>
</section>
</s.Card>
<s.Card>
<header>
<p>Cartão</p>
<FiCreditCard size="24px" color="orange" />
</header>
<section>
<p>R$</p>
<h1>0,00</h1>
</section>
</s.Card>
<s.Card>
<header>
<p>Caixa</p>
<FiHardDrive size="24px" color="grey" />
</header>
<section>
<p>R$</p>
<h1>0,00</h1>
</section>
</s.Card>
</s.CardContainer>
<s.Search>
<FiSearch size="24px" color="grey" />
<s.SearchInput placeholder="Consultar Material" />
</s.Search>
<s.CategoryContainer>
<CarouselProvider
naturalSlideWidth={100}
naturalSlideHeight={190}
totalSlides={6}
visibleSlides={5}
infinite
>
<Slider>
<Slide index={0}>
<s.CategoryItem>
<header>
<p>Delicatessen</p>
<img src={delicatessen} alt="" />
</header>
</s.CategoryItem>
</Slide>
<Slide index={1}>
<s.CategoryItem>
<header>
<p>Frios</p>
<img src={frios} alt="" />
</header>
</s.CategoryItem>
</Slide>
<Slide index={2}>
<s.CategoryItem>
<header>
<p>Salgados</p>
<img src={salgados} alt="" />
</header>
</s.CategoryItem>
</Slide>
<Slide index={3}>
<s.CategoryItem>
<header>
<p>Bebidas</p>
<img src={bebidas} alt="" />
</header>
</s.CategoryItem>
</Slide>
<Slide index={4}>
<s.CategoryItem>
<header>
<p>Sorvetes</p>
<img src={sorvetes} alt="" />
</header>
</s.CategoryItem>
</Slide>
<Slide index={5}>
<s.CategoryItem>
<header>
<p>Sanduíches</p>
<img src={sanduiche} alt="" />
</header>
</s.CategoryItem>
</Slide>
</Slider>
<ButtonBack className="buttonBack"><FiChevronLeft size="24px" color="grey" /></ButtonBack>
<ButtonNext className="buttonNext"><FiChevronRight size="24px" color="grey" /></ButtonNext>
</CarouselProvider>
</s.CategoryContainer>
<ProductList>
{products.map((product) => (
<li key={product.id}>
<img src={product.image} alt={product.title} />
<span>
<strong>{product.title}</strong>
<p>{product.priceFormatted}</p>
</span>
<button type="button" onClick={() => handleAddProduct(product)}>
<FiPlusCircle size="24px" color="grey" />
</button>
</li>
))}
</ProductList>
</Layout>
);
}