import { DownloadOutlined, LeftOutlined, MinusOutlined, PlusOutlined, RightOutlined, SearchOutlined as SearchIcon, SmileOutlined, } from '@ant-design/icons'; import type { RadioChangeEvent } from 'antd'; import { Badge, Button, Cascader, Col, ConfigProvider, Divider, Input, InputNumber, Modal, Pagination, Radio, Rate, Row, Select, Space, Steps, Switch, Tree, TreeSelect, } from 'antd'; import type { DirectionType } from 'antd/es/config-provider'; import React, { useState } from 'react'; const InputGroup = Input.Group; const ButtonGroup = Button.Group; const { Option } = Select; const { TreeNode } = Tree; const { Search } = Input; const cascaderOptions = [ { value: 'tehran', label: 'تهران', children: [ { value: 'tehran-c', label: 'تهران', children: [ { value: 'saadat-abad', label: 'سعادت آیاد', }, ], }, ], }, { value: 'ardabil', label: 'اردبیل', children: [ { value: 'ardabil-c', label: 'اردبیل', children: [ { value: 'primadar', label: 'پیرمادر', }, ], }, ], }, { value: 'gilan', label: 'گیلان', children: [ { value: 'rasht', label: 'رشت', children: [ { value: 'district-3', label: 'منطقه ۳', }, ], }, ], }, ]; type Placement = 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight'; const Page: React.FC<{ popupPlacement: Placement }> = ({ popupPlacement }) => { const [currentStep, setCurrentStep] = useState(0); const [modalOpen, setModalOpen] = useState(false); const [badgeCount, setBadgeCount] = useState(5); const [showBadge, setShowBadge] = useState(true); const selectBefore = ( Http:// Https:// ); const selectAfter = ( .com .jp .cn .org ); // ==== Cascader ==== const cascaderFilter = (inputValue: string, path: { label: string }[]) => path.some((option) => option.label.toLowerCase().includes(inputValue.toLowerCase())); const onCascaderChange = (value: any) => { console.log(value); }; // ==== End Cascader ==== // ==== Modal ==== const showModal = () => { setModalOpen(true); }; const handleOk = (e: React.MouseEvent) => { console.log(e); setModalOpen(false); }; const handleCancel = (e: React.MouseEvent) => { console.log(e); setModalOpen(false); }; // ==== End Modal ==== const onStepsChange = (newCurrentStep: number) => { console.log('onChange:', newCurrentStep); setCurrentStep(newCurrentStep); }; // ==== Badge ==== const increaseBadge = () => { setBadgeCount(badgeCount + 1); }; const declineBadge = () => { setBadgeCount((prev) => (prev - 1 < 0 ? 0 : prev - 1)); }; const onChangeBadge = (checked: boolean) => { setShowBadge(checked); }; // ==== End Badge ==== return ( Cascader example } options={cascaderOptions} onChange={onCascaderChange} placeholder="یک مورد انتخاب کنید" popupPlacement={popupPlacement} /> With search: } options={cascaderOptions} onChange={onCascaderChange} placeholder="Select an item" popupPlacement={popupPlacement} showSearch={{ filter: cascaderFilter }} /> Switch example Radio Group example تهران اصفهان فارس خوزستان Button example } /> } /> } /> }> Download }> Download Backward Forward Loading Loading Tree example sss} key="0-0-1-0" /> Input (Input Group) example Option1 Option2 Select example Jack مورچه Disabled yiminghe مورچه مورچه option?.props.children.toLowerCase().includes(input.toLowerCase()) } > Jack سعید Tom TreeSelect example sss} key="random3" /> Modal example Open Modal نگاشتههای خود را اینجا قراردهید نگاشتههای خود را اینجا قراردهید نگاشتههای خود را اینجا قراردهید Steps example Rate example * Note: Half star not implemented in RTL direction, it will be supported after rc-rate{' '} implement rtl support. Badge example Pagination example Grid System example * Note: Every calculation in RTL grid system is from right side (offset, push, etc.) col-8 col-8 col-6 col-offset-6 col-6 col-offset-6 col-12 col-offset-6 col-18 col-push-6 col-6 col-pull-18 ); }; const App: React.FC = () => { const [direction, setDirection] = useState('ltr'); const [popupPlacement, setPopupPlacement] = useState('bottomLeft'); const changeDirection = (e: RadioChangeEvent) => { const directionValue = e.target.value; setDirection(directionValue); if (directionValue === 'rtl') { setPopupPlacement('bottomRight'); } else { setPopupPlacement('bottomLeft'); } }; return ( <> Change direction of components: LTR RTL > ); }; export default App;
نگاشتههای خود را اینجا قراردهید
* Note: Every calculation in RTL grid system is from right side (offset, push, etc.)