react-feather#ChevronUp JavaScript Examples
The following examples show how to use
react-feather#ChevronUp.
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.js From spooky-info with GNU General Public License v3.0 | 6 votes |
export function ButtonDropdown({ disabled = false, children, open, ...rest }) {
return (
<ButtonFaded {...rest} disabled={disabled} ope={open}>
<RowBetween>
<div style={{ display: 'flex', alignItems: 'center' }}>{children}</div>
{open ? (
<StyledIcon>
<ChevronUp size={24} />
</StyledIcon>
) : (
<StyledIcon>
<ChevronDown size={24} />
</StyledIcon>
)}
</RowBetween>
</ButtonFaded>
)
}
Example #2
Source File: TransactionHistoryTable.js From ucurtmetre with GNU General Public License v3.0 | 4 votes |
function TransactionHistoryTable({ data }) { const breakpoint = useBreakpoints(); const isMobile = breakpoint === 'isMobile'; const columns = useMemo( () => [ { Header: 'Kimden', accessor: 'from.name', Cell: ({ value }) => ( <div className="person with-icon"> <div>{value || 'Anonim'}</div> <div className="icon"> <ArrowRight /> </div> </div> ), }, { Header: 'Kime', accessor: 'to.name', Cell: ({ value, row: { original: { to }, }, }) => { let Element = 'div'; let linkProps; if (to.campaignCode && to.campaignCode !== 'donate-all') { Element = 'a'; linkProps = { href: `https://www.ucurtmaprojesi.com/campaign/${to.campaignCode}`, }; } return ( <Element className="person" {...linkProps}> {value} </Element> ); }, }, { Header: 'Ne Zaman', accessor: 'when', id: 'when', Cell: ({ value }) => <div>{dayjs().to(dayjs(value * 1000))}</div>, }, { Header: 'Ne Kadar', accessor: 'amount', Cell: ({ value, row: { original: { tokenName }, }, }) => ( <div className="amount">{`${ typeof value === 'number' ? Math.floor(value) : value } ${tokenName}`}</div> ), }, ], [] ); const defaultSort = useMemo(() => [{ id: 'when', desc: true }], []); const tableInstance = useTable( { columns, data, initialState: { sortBy: defaultSort, pageSize: 10, pageIndex: 0 }, disableMultiSort: true, disableSortRemove: true, }, useFlexLayout, useSortBy, usePagination ); const { getTableProps, headerGroups, prepareRow, page, canPreviousPage, canNextPage, pageOptions, pageCount, gotoPage, nextPage, previousPage, state: { pageIndex }, } = tableInstance; return ( <div className="table-wrapper"> <div {...(!isMobile && getTableProps())} className="table"> {!isMobile && headerGroups.map(headerGroup => ( <div {...headerGroup.getHeaderGroupProps({})} className="tr"> {headerGroup.headers.map(column => ( <div {...column.getHeaderProps(column.getSortByToggleProps())} className="th title" > {column.render('Header')} {column.isSorted ? ( column.isSortedDesc ? ( <ChevronDown /> ) : ( <ChevronUp /> ) ) : ( '' )} </div> ))} </div> ))} <div className="tbody"> {page.map(row => { prepareRow(row); return ( <div {...row.getRowProps()} className="tr"> {row.cells.map(cell => { return ( <div {...cell.getCellProps()} className="td"> {isMobile && ( <div className="td-header">{cell.render('Header')}</div> )} <div className="td-content">{cell.render('Cell')}</div> </div> ); })} </div> ); })} </div> </div> <div className="pagination"> <div> <button className="button icon-button" type="button" onClick={() => gotoPage(0)} disabled={!canPreviousPage} > <ChevronsLeft /> </button> <button className="button icon-button" type="button" onClick={() => previousPage()} disabled={!canPreviousPage} > <ChevronLeft /> </button> <button className="button icon-button" type="button" onClick={() => nextPage()} disabled={!canNextPage} > <ChevronRight /> </button> <button className="button icon-button" type="button" onClick={() => gotoPage(pageCount - 1)} disabled={!canNextPage} > <ChevronsRight /> </button> </div> <span> Toplam {pageOptions.length} sayfadan <strong>{pageIndex + 1}.</strong> sayfayı görüntülüyorsunuz. </span> </div> </div> ); }
Example #3
Source File: map-selector.js From covid19-dashboard with MIT License | 4 votes |
MapSelector = ({selectedMapId, maps, selectMap, selectStat}) => {
const selectedMap = maps.find(m => m.name === selectedMapId)
const [isOpen, setIsOpen] = useState(false)
const handleMap = useCallback(map => {
const {name, property} = map
selectStat(property)
selectMap(name)
setIsOpen(false)
}, [selectMap, selectStat])
const handleClick = useCallback(event => {
event.stopPropagation()
setIsOpen(!isOpen)
}, [isOpen])
return (
<div className='switch'>
<div className='header' onClick={handleClick}>
<span>{selectedMap.name}</span> {isOpen ? <ChevronUp /> : <ChevronDown />}
</div>
{isOpen && (
<div className='menu'>
{maps.map(map => (
<div
key={map.name}
className={`menu-item ${selectedMapId === map.name ? 'selected' : ''}`}
onClick={() => handleMap(map)}
>
<span>{map.name}</span> {map.name === selectedMapId && <Check />}
</div>
))}
</div>
)}
<style jsx>{`
.switch {
display: flex;
flex-direction: column;
position: relative;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.5em;
}
.switch:hover {
cursor: pointer;
}
.menu {
position: absolute;
display: flex;
flex-direction: column;
width: 100%;
top: 100%;
background-color: #000000aa;
}
.menu-item {
display: flex;
align-items: center;
padding: 0.2em 0.5em;
}
.menu-item:hover {
background-color: ${colors.lightGrey};
color: #000;
}
.menu-item.selected:hover {
background-color: transparent;
cursor: initial;
}
span {
margin-right: 0.4em;
}
`}</style>
</div>
)
}
Example #4
Source File: select-input.js From covid19-dashboard with MIT License | 4 votes |
SelectInput = ({selected, options, handleSelect}) => {
const [isOpen, setIsOpen] = useState(false)
const theme = useContext(ThemeContext)
const {isTabletDevice} = useContext(AppContext)
const onSelect = useCallback(option => {
handleSelect(option)
setIsOpen(false)
}, [handleSelect])
return (
<div className='select-input'>
<div className='custom-select' onClick={() => setIsOpen(!isOpen)}>
<span>{selected.label}</span> {isOpen ? <ChevronDown /> : <ChevronUp />}
</div>
{isOpen && (
<div className='custom-options'>
{options.map(option => {
const {value, label} = option
return (
<div
key={value}
className={`option ${value === selected.value ? 'selected' : ''}`}
onClick={() => onSelect(option)}
>
<span>{label}</span>
</div>
)
})}
</div>
)}
<style jsx>{`
.select-input {
position: relative;
display: flex;
flex-direction: column;
width: ${isTabletDevice ? '100%' : ''};
height: ${isTabletDevice ? '100%' : ''};
background-color: ${colors.lightGrey};
}
.custom-select {
display: flex;
justify-content: center;
align-items: center;
padding: ${isTabletDevice ? '0.8em' : '0.5em'};;
}
.custom-select,
.select-input:hover {
cursor: pointer;
}
.custom-options {
display: flex;
z-index: 1;
position: absolute;
top: 100%;
width: 100%;
flex-direction: column;
background-color: ${colors.lighterGrey};
box-shadow: 0 1px 4px ${colors.lightGrey};
transition: height 1s;
}
.option {
display: flex;
align-items: center;
padding: 0.5em 1em;
}
.option:hover {
background-color: ${theme.secondary};
color: #fff;
}
.option.selected {
background-color: ${theme.primary};
color: #fff;
}
span {
margin-right: 0.4em;
}
`}</style>
</div>
)
}
Example #5
Source File: territories-mobile-map.js From covid19-dashboard with MIT License | 4 votes |
TerritoriesMobileMap = ({maps, context, children, disableClick}) => {
const themeContext = useContext(ThemeContext)
const {selectedLocation, setSelectedLocation} = useContext(AppContext)
const {selectedMapId, setSelectedMapId, setSelectedStat} = useContext(context)
const [showStats, setShowStats] = useState(false)
const [showDrom, setShowDrom] = useState(selectedLocation && droms.find(({code}) => selectedLocation === code))
const selectedMap = maps.find(m => m.name === selectedMapId)
const onClick = () => {
setShowDrom(!showDrom)
if (showDrom) {
setSelectedLocation('FRA')
}
}
return (
<div className='mobile-map-container'>
<div className='map-switch clickable' onClick={() => onClick()}>
Voir la France {showDrom ? 'métropolitaine' : 'd’outremer'}
</div>
{maps.length > 1 && (
<div className='map-selector clickable'>
<MapSelector selectedMapId={selectedMapId} maps={maps} selectMap={setSelectedMapId} selectStat={setSelectedStat} />
</div>
)}
<div className='map-content'>
<div>
{showDrom ? (
<Drom map={selectedMap} disableClick={disableClick} />
) : (
<MapContext
code={selectedLocation}
map={selectedMap}
disableClick={disableClick}
disableFitbound={selectedMap.disableFitbound}
/>
)}
</div>
</div>
{children && selectedLocation && (
<div className={`mobile-sumup ${showStats ? 'show' : 'hide'}`}>
<div className='show-stats clickable' onClick={() => setShowStats(!showStats)}>
{showStats ? 'Masquer' : 'Afficher'} les données {geo[selectedLocation].nom} {showStats ? <ChevronDown /> : <ChevronUp />}
</div>
<div className='mobile-statistics'>
{children}
</div>
</div>
)}
<style jsx>{`
.mobile-map-container {
z-index: 2;
flex: 1;
position: relative;
display: flex;
flex-direction: column;
}
.map-switch {
padding: 0.5em;
text-align: center;
color: #FFF;
background-color: ${themeContext.primary};
}
.map-selector {
z-index: 2;
background-color: #00000099;
color: #fff;
}
.map-content,
.map-content div {
z-index: 1;
display: flex;
flex: 1;
}
.mobile-sumup {
z-index: 2;
display: flex;
position: absolute;
flex-direction: column;
bottom: 0;
background-color: #fff;
width: 100%;
height: 100%;
margin: auto;
transition: 0.5s;
}
.mobile-sumup.hide {
height: ${SHOW_STATS_HEIGHT}px;
padding: 0;
}
.mobile-sumup.show {
height: 100%;
}
.show-stats {
display: flex;
align-items: center;
justify-content: center;
padding: 0.4em;
color: #fff;
min-height: ${SHOW_STATS_HEIGHT}px;
background-color: ${themeContext.primary};
}
.mobile-statistics {
position: relative;
flex: 1;
overflow: auto;
}
.clickable:hover {
cursor:
}
`}</style>
</div>
)
}