better file select

This commit is contained in:
SpikeHD
2022-05-10 00:48:26 -07:00
parent 6dcc91f216
commit 870f873d0f

View File

@@ -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>