@ant-design/icons#MinusOutlined JavaScript Examples
The following examples show how to use
@ant-design/icons#MinusOutlined.
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: change.jsx From virtuoso-design-system with MIT License | 6 votes |
render() {
return (
<div>
<div>
<Badge count={this.state.count}>
<a href="#" className="head-example" />
</Badge>
<ButtonGroup>
<Button onClick={this.decline}>
<MinusOutlined />
</Button>
<Button onClick={this.increase}>
<PlusOutlined />
</Button>
<Button onClick={this.random}>
<QuestionOutlined />
</Button>
</ButtonGroup>
</div>
<div style={{ marginTop: 10 }}>
<Badge dot={this.state.show}>
<a href="#" className="head-example" />
</Badge>
<Switch onChange={this.onChange} checked={this.state.show} />
</div>
</div>
);
}
Example #2
Source File: circle-dynamic.jsx From virtuoso-design-system with MIT License | 6 votes |
render() {
return (
<>
<Progress type="circle" percent={this.state.percent} />
<Button.Group>
<Button onClick={this.decline} icon={<MinusOutlined />} />
<Button onClick={this.increase} icon={<PlusOutlined />} />
</Button.Group>
</>
);
}
Example #3
Source File: dynamic.jsx From virtuoso-design-system with MIT License | 6 votes |
render() {
return (
<>
<Progress percent={this.state.percent} />
<Button.Group>
<Button onClick={this.decline} icon={<MinusOutlined />} />
<Button onClick={this.increase} icon={<PlusOutlined />} />
</Button.Group>
</>
);
}
Example #4
Source File: menu.jsx From react-visual-modeling with MIT License | 5 votes |
actionMenu = ({
onAddEdge,
onDelEdge,
onSetGridMode
}) => [
{
key: 'zoom-in',
disable: true
},
{
icon: <StarOutlined />,
key: 'star',
onClick: () => {
alert('点击收藏!')
}
},
{
icon: <PlusOutlined />,
key: 'plus',
title: '添加一条连线',
onClick: () => {
onAddEdge();
}
},
{
icon: <MinusOutlined />,
key: 'minus',
title: '删除一条连线',
onClick: () => {
onDelEdge();
}
},
{
icon: <GatewayOutlined />,
title: '框选',
key: 'select',
onClick: () => {
onSetGridMode();
}
}
]
Example #5
Source File: ComponentActions.jsx From ui with MIT License | 5 votes |
ComponentActions = (props) => {
const { experimentId, name, componentType } = props;
const dispatch = useDispatch();
const selectedGenes = useSelector((state) => state.genes.selected);
const displayedGenes = useSelector((state) => state.genes.expression?.views[componentType]?.data);
const performGeneOperation = (genesOperation) => {
let newGenes = _.cloneDeep(selectedGenes);
if (genesOperation === geneOperations.ADD && displayedGenes) {
newGenes = Array.from(new Set(displayedGenes.concat(selectedGenes)));
}
if (genesOperation === geneOperations.REMOVE && displayedGenes) {
newGenes = displayedGenes.filter((gene) => !selectedGenes.includes(gene));
}
dispatch(loadGeneExpression(experimentId, newGenes, componentType));
};
const menu = (
<Menu size='small'>
<Menu.Item key='0' icon={<PlusOutlined />} onClick={() => performGeneOperation(geneOperations.ADD)}>
Add
</Menu.Item>
<Menu.Item key='1' icon={<MinusOutlined />} onClick={() => performGeneOperation(geneOperations.REMOVE)}>
Remove
</Menu.Item>
<Menu.Item key='2' icon={<RedoOutlined />} onClick={() => performGeneOperation(geneOperations.OVERWRITE)}>
Overwrite
</Menu.Item>
</Menu>
);
if (selectedGenes.length === 0) {
return (<></>);
}
return (
<Dropdown arrow type='link' size='small' overlay={menu} trigger={['click']}>
<Button type='link' size='small'>
{name}
</Button>
</Dropdown>
);
}
Example #6
Source File: QuadraticDiplomacyVote.jsx From quadratic-diplomacy with MIT License | 4 votes |
export default function QuadraticDiplomacyVote({
voteCredits,
contributorEntries,
tx,
writeContracts,
isVoter,
mainnetProvider,
}) {
const [selectedContributors, setSelectedContributors] = useState({});
const [currentStep, setCurrentStep] = useState(1);
const [spentVoteTokens, setSpentVoteTokens] = useState(0);
const [isSendingTx, setIsSendingTx] = useState(false);
const availableVoteTokens = voteCredits?.toNumber() ?? 0;
const remainingVoteTokens = availableVoteTokens - spentVoteTokens;
const contributors = useMemo(
() =>
contributorEntries.reduce((entries, current) => {
entries[current.wallet] = 0;
return entries;
}, {}),
[contributorEntries],
);
const allContributorsSelected = Object.keys(contributors).length === Object.keys(selectedContributors).length;
if (!isVoter) {
return (
<div style={{ border: "1px solid", padding: "40px", width: 800, margin: "auto", marginTop: 64, textAlign: "left" }}>
<Title level={4} style={{ fontFamily: "Space Mono" }}>Access denied</Title>
<p>You are not part of the members of this election.</p>
</div>
);
}
const handleSelectAllContributors = () =>
allContributorsSelected ? setSelectedContributors({}) : setSelectedContributors(contributors);
const handleContributorSelection = (e, contributorAddress) => {
setSelectedContributors(prevSelectedContributors => {
if (prevSelectedContributors[contributorAddress] !== undefined) {
const state = { ...prevSelectedContributors };
delete state[contributorAddress];
return state;
} else {
return {
...prevSelectedContributors,
[contributorAddress]: contributors[contributorAddress],
};
}
});
};
const handleContributorVote = (e, op, clickedContributorAddress) => {
// adjust available vote tokens
setSpentVoteTokens(prevSpentVoteTokens => (op === "add" ? prevSpentVoteTokens + 1 : prevSpentVoteTokens - 1));
// update contributor vote tokens
setSelectedContributors(prevSelectedContributors => ({
...prevSelectedContributors,
[clickedContributorAddress]:
op === "add"
? Math.min(prevSelectedContributors[clickedContributorAddress] + 1, availableVoteTokens)
: Math.max(prevSelectedContributors[clickedContributorAddress] - 1, 0),
}));
};
const handleSubmitVotes = async () => {
const wallets = [];
const amounts = [];
Object.entries(selectedContributors).forEach(([contributorAddress, voteTokens]) => {
wallets.push(contributorAddress);
amounts.push(voteTokens);
});
setIsSendingTx(true);
await tx(writeContracts.QuadraticDiplomacyContract.voteMultiple(wallets, amounts), update => {
if (update && (update.status === "confirmed" || update.status === 1)) {
setIsSendingTx(false);
setSpentVoteTokens(0);
setCurrentStep(3);
} else if (update.error) {
setIsSendingTx(false);
}
});
};
return (
<div style={{ border: "1px solid", padding: "40px", width: 800, margin: "auto", marginTop: 64, textAlign: "left" }}>
<Steps initial={1} current={currentStep} labelPlacement="vertical">
<Steps.Step
title="Select Contributors"
subTitle={`${contributorEntries.length} contributors`}
icon={<SmileTwoTone />}
/>
<Steps.Step
title="Allocate Votes"
subTitle={`${remainingVoteTokens} votes left`}
icon={<LikeTwoTone twoToneColor="#eb2f96" />}
/>
<Steps.Step title="Done" subTitle="Thank you!" icon={<CheckCircleTwoTone twoToneColor="#52c41a" />} />
</Steps>
<Divider />
{currentStep === 1 ? (
<List
size="large"
itemLayout="horizontal"
header={<Title level={4} style={{ fontFamily: "Space Mono" }}>1. Who've you been working with?</Title>}
style={{ width: "600px", margin: "0 auto" }}
footer={
<Row justify="end">
<Button
type="primary"
onClick={() => setCurrentStep(2)}
disabled={!Object.keys(selectedContributors).length}
>
Next
</Button>
</Row>
}
dataSource={Object.entries(contributors)}
renderItem={([contributorAddress, votes], index) => (
<>
{index === 0 && (
<List.Item>
<Checkbox
indeterminate={!allContributorsSelected && Object.keys(selectedContributors).length}
checked={allContributorsSelected}
onChange={handleSelectAllContributors}
>
Select All
</Checkbox>
</List.Item>
)}
<List.Item key={contributorAddress}>
<Checkbox
size="large"
onClick={e => handleContributorSelection(e, contributorAddress)}
checked={selectedContributors[contributorAddress] !== undefined}
>
<Address address={contributorAddress} ensProvider={mainnetProvider} fontSize={16} size="short" />
</Checkbox>
</List.Item>
</>
)}
/>
) : currentStep === 2 ? (
<List
size="large"
itemLayout="horizontal"
style={{ width: "600px", margin: "0 auto" }}
header={
<Space direction="vertical">
<Title level={4} style={{ fontFamily: "Space Mono" }}>2. Allocate votes</Title>
<Title level={5}>
Remaining vote tokens:
<Badge
showZero
overflowCount={1000}
count={remainingVoteTokens}
style={{ backgroundColor: "#52c41a" }}
/>
</Title>
</Space>
}
footer={
<Row justify="end">
{!isSendingTx ? (
<>
<Button onClick={() => setCurrentStep(1)} style={{ marginRight: "8px" }} type="secondary">Go back</Button>
<Button type="primary" onClick={handleSubmitVotes}>
Commit votes
</Button>
</>
) : (
<Spin size="small" />
)}
</Row>
}
dataSource={Object.entries(selectedContributors)}
renderItem={([contributorAddress, contributor]) => (
<>
<Badge.Ribbon
showZero
overflowCount={1000}
text={<Title level={5}>{contributor} </Title>}
style={{
backgroundColor: contributor ? "#eb2f96" : "grey",
height: 24,
width: 30,
marginRight: -5,
}}
/>
<List.Item
key={contributorAddress}
extra={
<Button.Group>
<Button
danger
ghost
onClick={e => handleContributorVote(e, "remove", contributorAddress)}
disabled={!contributor}
>
<MinusOutlined />
</Button>
<Button
type="primary"
ghost
onClick={e => handleContributorVote(e, "add", contributorAddress)}
disabled={!remainingVoteTokens}
>
<PlusOutlined />
</Button>
</Button.Group>
}
>
<List.Item.Meta
avatar={
<Address address={contributorAddress} fontSize={16} size="short" ensProvider={mainnetProvider} />
}
/>
</List.Item>
</>
)}
/>
) : (
currentStep === 3 && (
<>
<Title level={3} style={{ fontFamily: "Space Mono" }}>Thank you for voting.</Title>
<p>The allocation to this workstream will be informed by your votes. See you next month!</p>
<Title level={5} style={{ marginTop: "24px" }}>Your votes:</Title>
{Object.entries(selectedContributors).map(([contributorAddress, voteTokens]) => (
<p key={contributorAddress}>
<Address address={contributorAddress} fontSize={16} size="short" ensProvider={mainnetProvider} /> (
<Text>{voteTokens}</Text>)
</p>
))}
</>
)
)}
</div>
);
}
Example #7
Source File: HeatmapGroupBySettings.jsx From ui with MIT License | 4 votes |
HeatmapGroupBySettings = (props) => {
const dispatch = useDispatch();
const { componentType } = props;
const groupedTracksKeys = useSelector(
(state) => state.componentConfig[componentType].config.groupedTracks,
);
const allCellSetsGroupBys = useSelector(getCellSetsHierarchy());
const getCellSetsOrder = () => {
const groupedCellSets = [];
// from the enabled cell sets keys we get, find their corresponding information
groupedTracksKeys
.forEach((trackKey) => {
const groupBy = allCellSetsGroupBys
.find((cellSetGroupBy) => cellSetGroupBy.key === trackKey);
groupedCellSets.push(groupBy);
});
// About the filtering: If we have failed to find some of the groupbys information,
// then ignore those (this is useful for groupbys that sometimes dont show up, like 'samples')
return groupedCellSets.filter((groupedCellSet) => groupedCellSet !== undefined);
};
const isInitialRenderRef = useRef(true);
const [cellSetsOrder, setCellSetsOrder] = useState(getCellSetsOrder());
const previousGroupedKeys = () => cellSetsOrder.map((cellSet) => cellSet.key);
useEffect(() => {
if (isInitialRenderRef.current) {
isInitialRenderRef.current = false;
return;
}
if (cellSetsOrder.length === 0) {
return;
}
dispatch(
updatePlotConfig(componentType, {
groupedTracks: cellSetsOrder.map((cellSet) => cellSet.key),
}),
);
}, [cellSetsOrder]);
useEffect(() => {
if (!_.isEqual(previousGroupedKeys(), groupedTracksKeys)) {
const newOrder = getCellSetsOrder();
setCellSetsOrder(newOrder);
}
}, [groupedTracksKeys]);
const indexOfCellSet = (cellSet) => cellSetsOrder.findIndex((elem) => (elem.key === cellSet.key));
// This is so that a click on + or - buttons doesn't close the menu
const stopPropagationEvent = (e) => e.stopPropagation();
const menu = (
<Menu>
{
allCellSetsGroupBys
.map((cellSet, indx) => {
const positionInCellSetOrder = indexOfCellSet(cellSet);
return (
// eslint-disable-next-line react/no-array-index-key
<Menu.Item key={indx} size='small'>
<div onClick={stopPropagationEvent} onKeyDown={stopPropagationEvent}>
<Button
shape='square'
size='small'
style={{ marginRight: '5px' }}
icon={positionInCellSetOrder > -1 ? <MinusOutlined /> : <PlusOutlined />}
onClick={() => {
const newCellSetsOrder = [...cellSetsOrder];
if (positionInCellSetOrder > -1) {
// If the cell is included in the cellSet, we have to remove it
newCellSetsOrder.splice(positionInCellSetOrder, 1);
} else {
// If the cell is not included in the cellSet, we have to add it
newCellSetsOrder.push(cellSet);
}
setCellSetsOrder(newCellSetsOrder);
}}
/>
{cellSet.name}
</div>
</Menu.Item>
);
})
}
</Menu>
);
return (
<div style={{ padding: '5px' }} key='dropdown'>
<Space direction='vertical'>
<Dropdown overlay={menu} trigger='click hover'>
<div style={{ padding: '7px', border: '1px solid rgb(238,238,238)' }}>
Select the parameters to group by
<DownOutlined style={{ marginLeft: '5px' }} />
</div>
</Dropdown>
<ReorderableList
onChange={setCellSetsOrder}
listData={cellSetsOrder}
rightItem={(cellSet) => cellSet.name}
/>
</Space>
</div>
);
}
Example #8
Source File: direction.jsx From virtuoso-design-system with MIT License | 4 votes |
// ==== End Badge ====
render() {
const { currentStep } = this.state;
return (
<div className="direction-components">
<Row>
<Col span={24}>
<Divider orientation="left">Cascader example</Divider>
<Cascader
suffixIcon={<SearchIcon />}
options={cascaderOptions}
onChange={this.onCascaderChange}
placeholder="یک مورد انتخاب کنید"
popupPlacement={this.props.popupPlacement}
/>
With search:
<Cascader
suffixIcon={<SmileOutlined />}
options={cascaderOptions}
onChange={this.onCascaderChange}
placeholder="Select an item"
popupPlacement={this.props.popupPlacement}
showSearch={this.cascaderFilter}
/>
</Col>
</Row>
<br />
<Row>
<Col span={12}>
<Divider orientation="left">Switch example</Divider>
<Switch defaultChecked />
<Switch loading defaultChecked />
<Switch size="small" loading />
</Col>
<Col span={12}>
<Divider orientation="left">Radio Group example</Divider>
<Radio.Group defaultValue="c" buttonStyle="solid">
<Radio.Button value="a">تهران</Radio.Button>
<Radio.Button value="b" disabled>
اصفهان
</Radio.Button>
<Radio.Button value="c">فارس</Radio.Button>
<Radio.Button value="d">خوزستان</Radio.Button>
</Radio.Group>
</Col>
</Row>
<br />
<Row>
<Col span={12}>
<Divider orientation="left">Button example</Divider>
<div className="button-demo">
<Button type="primary" icon={<DownloadOutlined />} />
<Button type="primary" shape="circle" icon={<DownloadOutlined />} />
<Button type="primary" shape="round" icon={<DownloadOutlined />} />
<Button type="primary" shape="round" icon={<DownloadOutlined />}>
Download
</Button>
<Button type="primary" icon={<DownloadOutlined />}>
Download
</Button>
<br />
<Button.Group>
<Button type="primary">
<LeftOutlined />
Backward
</Button>
<Button type="primary">
Forward
<RightOutlined />
</Button>
</Button.Group>
<Button type="primary" loading>
Loading
</Button>
<Button type="primary" size="small" loading>
Loading
</Button>
</div>
</Col>
<Col span={12}>
<Divider orientation="left">Tree example</Divider>
<Tree
showLine
checkable
defaultExpandedKeys={['0-0-0', '0-0-1']}
defaultSelectedKeys={['0-0-0', '0-0-1']}
defaultCheckedKeys={['0-0-0', '0-0-1']}
>
<TreeNode title="parent 1" key="0-0">
<TreeNode title="parent 1-0" key="0-0-0" disabled>
<TreeNode title="leaf" key="0-0-0-0" disableCheckbox />
<TreeNode title="leaf" key="0-0-0-1" />
</TreeNode>
<TreeNode title="parent 1-1" key="0-0-1">
<TreeNode title={<span style={{ color: '#1890ff' }}>sss</span>} key="0-0-1-0" />
</TreeNode>
</TreeNode>
</Tree>
</Col>
</Row>
<br />
<Row>
<Col span={24}>
<Divider orientation="left">Input (Input Group) example</Divider>
<InputGroup size="large">
<Row gutter={8}>
<Col span={5}>
<Input defaultValue="0571" />
</Col>
<Col span={8}>
<Input defaultValue="26888888" />
</Col>
</Row>
</InputGroup>
<br />
<InputGroup compact>
<Input style={{ width: '20%' }} defaultValue="0571" />
<Input style={{ width: '30%' }} defaultValue="26888888" />
</InputGroup>
<br />
<InputGroup compact>
<Select defaultValue="Option1">
<Option value="Option1">Option1</Option>
<Option value="Option2">Option2</Option>
</Select>
<Input style={{ width: '50%' }} defaultValue="input content" />
<InputNumber />
</InputGroup>
<br />
<Search placeholder="input search text" enterButton="Search" size="large" />
<br />
<br />
<div style={{ marginBottom: 16 }}>
<Input
addonBefore={this.selectBefore}
addonAfter={this.selectAfter}
defaultValue="mysite"
/>
</div>
<br />
<Row>
<Col span={12}>
<Divider orientation="left">Select example</Divider>
<Select mode="multiple" defaultValue="مورچه" style={{ width: 120 }}>
<Option value="jack">Jack</Option>
<Option value="مورچه">مورچه</Option>
<Option value="disabled" disabled>
Disabled
</Option>
<Option value="Yiminghe">yiminghe</Option>
</Select>
<Select defaultValue="مورچه" style={{ width: 120 }} disabled>
<Option value="مورچه">مورچه</Option>
</Select>
<Select defaultValue="مورچه" style={{ width: 120 }} loading>
<Option value="مورچه">مورچه</Option>
</Select>
<Select
showSearch
style={{ width: 200 }}
placeholder="Select a person"
optionFilterProp="children"
filterOption={(input, option) =>
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
>
<Option value="jack">Jack</Option>
<Option value="سعید">سعید</Option>
<Option value="tom">Tom</Option>
</Select>
</Col>
<Col span={12}>
<Divider orientation="left">TreeSelect example</Divider>
<div>
<TreeSelect
showSearch
style={{ width: '100%' }}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
placeholder="Please select"
allowClear
treeDefaultExpandAll
>
<TreeNode value="parent 1" title="parent 1" key="0-1">
<TreeNode value="parent 1-0" title="parent 1-0" key="0-1-1">
<TreeNode value="leaf1" title="my leaf" key="random" />
<TreeNode value="leaf2" title="your leaf" key="random1" />
</TreeNode>
<TreeNode value="parent 1-1" title="parent 1-1" key="random2">
<TreeNode
value="sss"
title={<b style={{ color: '#08c' }}>sss</b>}
key="random3"
/>
</TreeNode>
</TreeNode>
</TreeSelect>
</div>
</Col>
</Row>
<br />
<Row>
<Col span={24}>
<Divider orientation="left">Modal example</Divider>
<div>
<Button type="primary" onClick={this.showModal}>
Open Modal
</Button>
<Modal
title="پنچره ساده"
visible={this.state.modalVisible}
onOk={this.handleOk}
onCancel={this.handleCancel}
>
<p>نگاشتههای خود را اینجا قراردهید</p>
<p>نگاشتههای خود را اینجا قراردهید</p>
<p>نگاشتههای خود را اینجا قراردهید</p>
</Modal>
</div>
</Col>
</Row>
<br />
<Row>
<Col span={24}>
<Divider orientation="left">Steps example</Divider>
<div>
<Steps progressDot current={currentStep}>
<Step title="Finished" description="This is a description." />
<Step title="In Progress" description="This is a description." />
<Step title="Waiting" description="This is a description." />
</Steps>
<br />
<Steps current={currentStep} onChange={this.onStepsChange}>
<Step title="Step 1" description="This is a description." />
<Step title="Step 2" description="This is a description." />
<Step title="Step 3" description="This is a description." />
</Steps>
</div>
</Col>
</Row>
<br />
<Row>
<Col span={12}>
<Divider orientation="left">Rate example</Divider>
<div>
<Rate defaultValue={2.5} />
<br />
<strong>* Note:</strong> Half star not implemented in RTL direction, it will be
supported after <a href="https://github.com/react-component/rate">rc-rate</a>{' '}
implement rtl support.
</div>
</Col>
<Col span={12}>
<Divider orientation="left">Badge example</Divider>
<div>
<div>
<Badge count={this.state.badgeCount}>
<a href="#" className="head-example" />
</Badge>
<ButtonGroup>
<Button onClick={this.declineBadge}>
<MinusOutlined />
</Button>
<Button onClick={this.increaseBadge}>
<PlusOutlined />
</Button>
</ButtonGroup>
</div>
<div style={{ marginTop: 10 }}>
<Badge dot={this.state.showBadge}>
<a href="#" className="head-example" />
</Badge>
<Switch onChange={this.onChangeBadge} checked={this.state.showBadge} />
</div>
</div>
</Col>
</Row>
</Col>
</Row>
<br />
<br />
<Row>
<Col span={24}>
<Divider orientation="left">Pagination example</Divider>
<Pagination showSizeChanger defaultCurrent={3} total={500} />
</Col>
</Row>
<br />
<Row>
<Col span={24}>
<Divider orientation="left">Grid System example</Divider>
<div className="grid-demo">
<div className="code-box-demo">
<p>
<strong>* Note:</strong> Every calculation in RTL grid system is from right side
(offset, push, etc.)
</p>
<Row>
<Col span={8}>col-8</Col>
<Col span={8} offset={8}>
col-8
</Col>
</Row>
<Row>
<Col span={6} offset={6}>
col-6 col-offset-6
</Col>
<Col span={6} offset={6}>
col-6 col-offset-6
</Col>
</Row>
<Row>
<Col span={12} offset={6}>
col-12 col-offset-6
</Col>
</Row>
<Row>
<Col span={18} push={6}>
col-18 col-push-6
</Col>
<Col span={6} pull={18}>
col-6 col-pull-18
</Col>
</Row>
</div>
</div>
</Col>
</Row>
</div>
);
}