Files
PyUIBuilder/src/components/header.js

49 lines
1.4 KiB
JavaScript
Raw Normal View History

2024-09-26 11:59:24 +05:30
import { useEffect, useState } from "react"
2024-09-08 21:58:53 +05:30
2024-09-13 19:24:03 +05:30
import { Select, Input, Button } from "antd"
import { DownloadOutlined, DownOutlined } from "@ant-design/icons"
2024-09-26 11:59:24 +05:30
import FrameWorks from "../constants/frameworks"
2024-09-08 21:58:53 +05:30
const items = [
{
2024-09-26 11:59:24 +05:30
value: FrameWorks.TKINTER,
2024-09-08 21:58:53 +05:30
label: 'tkinter',
},
{
2024-09-26 11:59:24 +05:30
value: FrameWorks.CUSTOMTK,
2024-09-08 21:58:53 +05:30
label: 'customtk',
},
]
2024-09-26 11:59:24 +05:30
function Header({projectName, onProjectNameChange, framework, onFrameworkChange,
onExportClick, className=''}){
2024-09-08 21:58:53 +05:30
return (
<div className={`tw-w-full tw-bg-primaryBg tw-p-2 tw-flex tw-place-items-center
2024-09-26 11:59:24 +05:30
${className||''}`}>
2024-09-08 21:58:53 +05:30
<Select
2024-09-26 11:59:24 +05:30
// defaultValue={framework}
value={framework}
2024-09-08 21:58:53 +05:30
options={items}
2024-09-26 11:59:24 +05:30
// onSelect={(key) => {console.log("value: ", key); onFrameworkChange(key); }}
onChange={(key) => {onFrameworkChange(key)}}
2024-09-08 21:58:53 +05:30
className="tw-min-w-[150px]"
/>
2024-09-13 19:24:03 +05:30
<div className="tw-ml-auto tw-flex tw-gap-2 tw-place-content-center">
2024-09-26 11:59:24 +05:30
<Input value={projectName} onChange={(e) => onProjectNameChange(e.target.value)} placeholder="project name"/>
<Button icon={<DownloadOutlined />} onClick={onExportClick}>
2024-09-13 19:24:03 +05:30
Export code
</Button>
2024-09-08 21:58:53 +05:30
</div>
</div>
)
}
export default Header