mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2026-02-04 09:25:16 +01:00
better file select
This commit is contained in:
@@ -1,11 +1,12 @@
|
|||||||
import React from 'react'
|
import React, { RefObject } from 'react'
|
||||||
|
import { open } from '@tauri-apps/api/dialog'
|
||||||
import TextInput from './TextInput'
|
import TextInput from './TextInput'
|
||||||
import File from '../../../resources/icons/folder.svg'
|
import File from '../../../resources/icons/folder.svg'
|
||||||
|
|
||||||
import './DirInput.css'
|
import './DirInput.css'
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
value?: string;
|
value?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IState {
|
interface IState {
|
||||||
@@ -19,17 +20,21 @@ export default class DirInput extends React.Component<IProps, IState> {
|
|||||||
this.state = {
|
this.state = {
|
||||||
value: props.value || ''
|
value: props.value || ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.handleIconClick = this.handleIconClick.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFileSelect() {
|
handleIconClick() {
|
||||||
console.log('piss')
|
open().then(path => {
|
||||||
|
console.log(path)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className='DirInput'>
|
<div className='DirInput'>
|
||||||
<TextInput value={this.state.value} placeholder='Set Game Location...' readOnly={true} />
|
<TextInput value={this.state.value} placeholder='Set Game Location...' readOnly={true} />
|
||||||
<div className="FileSelectIcon">
|
<div className="FileSelectIcon" onClick={this.handleIconClick}>
|
||||||
<img src={File} />
|
<img src={File} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user