mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-14 16:14:48 +01:00
more custom elements
This commit is contained in:
@@ -6,13 +6,13 @@
|
|||||||
height: 20px;
|
height: 20px;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
|
|
||||||
border: 2px solid #ebebec;
|
border: 2px solid #cecece;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.CheckboxDisplay:hover {
|
.CheckboxDisplay:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-color: #cecece;
|
border-color: #aaaaaa;
|
||||||
}
|
}
|
||||||
|
|
||||||
.CheckboxDisplay img {
|
.CheckboxDisplay img {
|
||||||
|
|||||||
23
src/ui/components/common/DirInput.css
Normal file
23
src/ui/components/common/DirInput.css
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
.DirInput {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.FileSelectIcon {
|
||||||
|
height: 20px;
|
||||||
|
margin: 10px;
|
||||||
|
filter: invert(99%) sepia(0%) saturate(1188%) hue-rotate(186deg) brightness(97%) contrast(67%);
|
||||||
|
|
||||||
|
transition: filter 0.1s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.FileSelectIcon:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
filter: invert(73%) sepia(0%) saturate(380%) hue-rotate(224deg) brightness(94%) contrast(90%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.FileSelectIcon img {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
38
src/ui/components/common/DirInput.tsx
Normal file
38
src/ui/components/common/DirInput.tsx
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import TextInput from './TextInput'
|
||||||
|
import File from '../../../resources/icons/folder.svg'
|
||||||
|
|
||||||
|
import './DirInput.css'
|
||||||
|
|
||||||
|
interface IProps {
|
||||||
|
value?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IState {
|
||||||
|
value: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class DirInput extends React.Component<IProps, IState> {
|
||||||
|
constructor(props: IProps) {
|
||||||
|
super(props)
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
value: props.value || ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
handleFileSelect() {
|
||||||
|
console.log('piss')
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div className='DirInput'>
|
||||||
|
<TextInput value={this.state.value} placeholder='Set Game Location...' readOnly={true} />
|
||||||
|
<div className="FileSelectIcon">
|
||||||
|
<img src={File} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
11
src/ui/components/common/TextInput.css
Normal file
11
src/ui/components/common/TextInput.css
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
.TextInput {
|
||||||
|
border: none;
|
||||||
|
border-bottom: 2px solid #cecece;
|
||||||
|
|
||||||
|
transition: border-bottom-color 0.1s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.TextInput:focus {
|
||||||
|
outline: none;
|
||||||
|
border-bottom-color: #ffd326;
|
||||||
|
}
|
||||||
32
src/ui/components/common/TextInput.tsx
Normal file
32
src/ui/components/common/TextInput.tsx
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import './TextInput.css'
|
||||||
|
|
||||||
|
interface IProps {
|
||||||
|
value?: string;
|
||||||
|
placeholder?: string;
|
||||||
|
onChange?: (value: string) => void;
|
||||||
|
readOnly?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IState {
|
||||||
|
value: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class TextInput extends React.Component<IProps, IState> {
|
||||||
|
constructor(props: IProps) {
|
||||||
|
super(props)
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
value: props.value || ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<input readOnly={this.props.readOnly || false} placeholder={this.props.placeholder || ''} className="TextInput" value={this.state.value} onChange={(e) => {
|
||||||
|
this.setState({ value: e.target.value })
|
||||||
|
if (this.props.onChange) this.props.onChange(e.target.value)
|
||||||
|
}} />
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import Checkbox from '../common/Checkbox'
|
import Checkbox from '../common/Checkbox'
|
||||||
|
import TextInput from '../common/TextInput'
|
||||||
|
import DirInput from '../common/DirInput'
|
||||||
import Menu from './Menu'
|
import Menu from './Menu'
|
||||||
import './Options.css'
|
import './Options.css'
|
||||||
|
|
||||||
@@ -17,6 +19,18 @@ export default class Options extends React.Component<Record<string, never>, neve
|
|||||||
<Checkbox id="testOption" label="" checked={true} onChange={() => console.log('Test Option Changed')} />
|
<Checkbox id="testOption" label="" checked={true} onChange={() => console.log('Test Option Changed')} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className='OptionSection'>
|
||||||
|
<div className='OptionLabel'>Test Input</div>
|
||||||
|
<div className='OptionValue'>
|
||||||
|
<TextInput placeholder='Test Value...' />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className='OptionSection'>
|
||||||
|
<div className='OptionLabel'>Test File Input</div>
|
||||||
|
<div className='OptionValue'>
|
||||||
|
<DirInput />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</Menu>
|
</Menu>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user