react-icons/fi#FiEdit2 TypeScript Examples
The following examples show how to use
react-icons/fi#FiEdit2.
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: achievements.tsx From portfolio with MIT License | 4 votes |
Achievements = () => {
return (
<PageSlideFade>
<Box align="start" mb={6}>
<Header mt={0} mb={0}>
Achievements
</Header>
</Box>
<VStack textAlign="start" align="start" mb={5}>
<Box>
<Heading fontSize="2xl" fontWeight="600" my={5}>
2021
</Heading>
<Box>
<TimelineItem icon={FiUsers}>Became a dad ❤️</TimelineItem>
<TimelineItem icon={FiPackage}>
Published my first post on this website{" "}
<InternalLink color={"blue.200"} url="/blog" text={"Blog"} />
</TimelineItem>
<TimelineItem icon={FiPackage}>
Published or contributed to{" "}
<InternalLink
color={"blue.200"}
url="/open-source"
text={"9 open-source repositories"}
/>
</TimelineItem>
<TimelineItem icon={FiBarChart2}>
Collected 6k+ post views and 350+ total reactions on{" "}
<ExternalLink
color={"blue.200"}
url="https://dev.to/m_ahmad"
text={"Dev.to"}
target="_blank"
/>
</TimelineItem>
<TimelineItem icon={FiHome} skipTrail>
Rebuilt my portfolio website with React, ChakraUI and
Framer-motion,{" "}
<ExternalLink
color={"blue.200"}
url="https://github.com/MA-Ahmad/portfolio"
text={"source on Github"}
target="_blank"
/>
.
</TimelineItem>
</Box>
</Box>
<Box>
<Heading fontSize="2xl" fontWeight="600" my={5}>
2020
</Heading>
<Box>
<TimelineItem icon={FiEdit2}>Wrote 5 blog posts</TimelineItem>
<TimelineItem icon={FiPackage}>
Published or contributed to{" "}
<ExternalLink
color={"blue.200"}
url="https://github.com/MA-Ahmad?tab=repositories"
text={"32 open-source repositories"}
target="_blank"
/>
</TimelineItem>
<TimelineItem icon={FiBarChart2}>
Collected 650+ post views and 15+ total reactions on{" "}
<ExternalLink
color={"blue.200"}
url="https://dev.to/m_ahmad"
text={"Dev.to"}
target="_blank"
/>
</TimelineItem>
<TimelineItem icon={FiHome} skipTrail>
Built my portfolio website with React and ChakraUI,{" "}
<ExternalLink
color={"blue.200"}
url="https://github.com/MA-Ahmad/portfolio2"
text={"source on Github"}
target="_blank"
/>
.
</TimelineItem>
</Box>
</Box>
</VStack>
</PageSlideFade>
);
}
Example #2
Source File: index.tsx From rocketredis with MIT License | 4 votes |
Connection: React.FC<IConnectionProps> = ({ connection }) => {
const [currentConnection, setCurrentConnection] = useRecoilState(
currentConnectionState
)
const [currentDatabase, setCurrentDatabase] = useRecoilState(
currentDatabaseState
)
const setCurrentKey = useSetRecoilState(currentKeyState)
const [databases, setDatabases] = useState<IDatabase[]>([])
const [connectionLoading, setConnectionLoading] = useState(false)
const [isConnectionFailed, setIsConnectionFailed] = useState(false)
const [isEditModalOpen, toggleEditModalOpen] = useToggle(false)
const [isDeleteModalOpen, toggleDeleteModalOpen] = useToggle(false)
const { t } = useTranslation('connection')
const { addToast } = useToast()
useEffect(() => {
if (currentConnection) {
setIsConnectionFailed(false)
}
}, [currentConnection])
const isConnected = useMemo(() => {
return currentConnection?.name === connection.name
}, [currentConnection?.name, connection.name])
const handleConnect = useCallback(async () => {
if (!isConnected) {
setConnectionLoading(true)
setCurrentConnection(undefined)
setCurrentDatabase(undefined)
setCurrentKey(undefined)
try {
const databases = await loadConnectionDatabases(connection)
setDatabases(databases)
setCurrentConnection(connection)
setCurrentDatabase(undefined)
} catch {
setIsConnectionFailed(true)
} finally {
setConnectionLoading(false)
}
}
}, [
connection,
isConnected,
setCurrentConnection,
setCurrentDatabase,
setCurrentKey
])
const handleDisconnect = useCallback(async () => {
setCurrentConnection(undefined)
setCurrentDatabase(undefined)
terminateConnection()
}, [setCurrentConnection, setCurrentDatabase])
const handleRefreshDatabases = useCallback(async () => {
try {
setConnectionLoading(true)
const databases = await loadConnectionDatabases(connection)
setDatabases(databases)
} catch {
setIsConnectionFailed(true)
} finally {
setConnectionLoading(false)
}
}, [connection])
const postSavingConnection = useCallback(async () => {
toggleEditModalOpen()
setCurrentConnection(undefined)
setCurrentDatabase(undefined)
setIsConnectionFailed(false)
}, [toggleEditModalOpen, setCurrentConnection, setCurrentDatabase])
const postDeletingConnection = useCallback(async () => {
toggleDeleteModalOpen()
setCurrentConnection(undefined)
setCurrentDatabase(undefined)
terminateConnection()
}, [toggleDeleteModalOpen, setCurrentConnection, setCurrentDatabase])
const handleSelectDatabase = useCallback(
async (database: IDatabase) => {
if (!currentConnection) {
return
}
try {
await initializeConnection(currentConnection, database)
setCurrentDatabase(database)
setCurrentKey(undefined)
} catch {
addToast({
type: 'error',
title: 'Failed to connect to database',
description:
'A connection to this Redis database could not be established.'
})
}
},
[currentConnection, addToast, setCurrentDatabase, setCurrentKey]
)
return (
<>
<Container
key={connection.name}
connected={isConnected}
errored={isConnectionFailed}
>
<ContextMenuTrigger id={`connection_actions_menu:${connection.name}`}>
<button type="button" disabled={isConnected} onClick={handleConnect}>
{connectionLoading ? (
<Loading>
<FiLoader />
</Loading>
) : (
<FiDatabase />
)}
{connection.name}
<FiChevronRight />
</button>
</ContextMenuTrigger>
<ContextMenu
id={`connection_actions_menu:${connection.name}`}
className="connection-actions-menu"
>
{isConnected ? (
<MenuItem onClick={handleDisconnect}>
<DisconnectButton>
<FiMinusCircle />
{t('contextMenu.disconnect')}
</DisconnectButton>
</MenuItem>
) : (
<MenuItem onClick={handleConnect}>
<ConnectButton>
<FiActivity />
{t('contextMenu.connect')}
</ConnectButton>
</MenuItem>
)}
<MenuItem onClick={toggleEditModalOpen}>
<FiEdit2 />
{t('contextMenu.editSettings')}
</MenuItem>
{isConnected && (
<MenuItem onClick={handleRefreshDatabases}>
<FiRefreshCcw />
{t('contextMenu.refreshDatabases')}
</MenuItem>
)}
<MenuItem onClick={toggleDeleteModalOpen}>
<FiTrash />
{t('contextMenu.deleteConnection')}
</MenuItem>
</ContextMenu>
{isConnected && !!databases.length && (
<DatabaseList>
{databases.map(database => (
<Database
connected={currentDatabase?.name === database.name}
key={database.name}
onClick={() => handleSelectDatabase(database)}
type="button"
>
<strong>{database.name}</strong>
<span>
{database.keys} {t('keys')}
</span>
</Database>
))}
</DatabaseList>
)}
{isConnectionFailed && (
<ConnectionError>
{t('connectionFailed')}{' '}
<button type="button" onClick={handleConnect}>
{t('retry')}
</button>
</ConnectionError>
)}
</Container>
<ConnectionFormModal
visible={isEditModalOpen}
onRequestClose={postSavingConnection}
connectionToEdit={connection}
/>
<DeleteConnectionModal
visible={isDeleteModalOpen}
onRequestClose={postDeletingConnection}
connectionToDelete={connection}
/>
</>
)
}
Example #3
Source File: RangeSelector.tsx From HoldemSolver with MIT License | 4 votes |
function RangeSelector(props: Props): React.ReactElement {
const {
handRange,
setComboActive,
setComboInactive,
setSuitComboActive,
setSuitComboInactive,
setRange,
setRangePairs,
setRangeBroadway,
setRangeAll,
clearRange,
activeCombo,
className = '',
} = props;
function setRangeText(rangeStr: string) {
setRange(HandRange.fromString(rangeStr));
}
const comboCount = handRange.comboCount();
const comboStates = handRange.comboStates();
const rangeStr = handRange.toString();
const suitCombos = new Array(16).fill(0).map((_, i) => <SuitCombo key={`${activeCombo}-${i}`} comboIndex={activeCombo} suitIndex={i}/>);
const suitStates = handRange.comboState(activeCombo);
return (
<RangeSelectorStyle className={className}>
<div className="range-selector-top-bar">
<div className="range-selector-top-bar-left">
<div className="range-title">
<h2>Raise first in</h2>
<FiEdit2/>
</div>
<div className="range-pos-game">
<span>6-MAX CASH</span>
<span>UTG+1</span>
</div>
</div>
<div className="range-selector-top-bar-right">
<Button onClick={() => {}} icon={<FiTrash2/>}>
Delete
</Button>
<Button onClick={() => {}} icon={<FiSave/>}>
Save
</Button>
</div>
</div>
<Matrix
elements={COMBO_NAMES}
states={comboStates}
onSelectElement={setComboActive}
onDeselectElement={setComboInactive}
rows={13}
cols={13}
className="range-selector-matrix"
/>
<div className="range-selector-bottom-bar">
<div className="range-selector-controls">
<div className="combo-count">
<span className="combo-count-selected">{comboCount}</span>/1326 combos selected{' '}
<span className="combo-count-selected">({((comboCount * 100) / 1326).toPrecision(3)}%)</span>
</div>
<div className="range-selector-controls-buttons">
<div className="range-selector-control-btn" onClick={setRangeAll}>
All
</div>
<div className="range-selector-control-btn" onClick={setRangePairs}>
Pairs
</div>
<div className="range-selector-control-btn" onClick={setRangeBroadway}>
Broadway
</div>
<div className="range-selector-control-btn range-selector-clear-btn" onClick={clearRange}>
Clear
</div>
</div>
<TextArea
rows={4}
cols={4}
className="range-selector-text-area"
placeholder="Enter range e.g. (QQ+,AK)"
onChange={setRangeText}
value={rangeStr}
/>
</div>
<Matrix
className="range-selector-suit-matrix"
onSelectElement={setSuitComboActive}
onDeselectElement={setSuitComboInactive}
elements={suitCombos}
states={suitStates}
rows={4}
cols={4}
/>
</div>
</RangeSelectorStyle>
);
}