Skip to content

Commit

Permalink
Desktop: refactor: Refactored props and added types to it
Browse files Browse the repository at this point in the history
  • Loading branch information
ab-elhaddad committed Apr 2, 2024
1 parent bef11bb commit 9832a9e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/app-desktop/gui/ConfigScreen/ConfigScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
updateSettingValue={updateSettingValue}
inputType={inputType}
inputStyle={inputStyle}
settings={this.state.settings}
fieldValue={this.state.settings[key]}
fonts={this.state.fonts}
/> :
<input
Expand Down
15 changes: 12 additions & 3 deletions packages/app-desktop/gui/ConfigScreen/FontSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,17 @@ const optionStyle: CSSProperties = {
cursor: 'pointer',
};

const FontSearch = (props: any) => {
const { _key: key, updateSettingValue, inputType, inputStyle, settings, fonts } = props;
interface Props {
_key: string;
updateSettingValue: (key: string, value: string)=> void;
inputType: string;
inputStyle: CSSProperties;
fieldValue: string;
fonts: string[];
}

const FontSearch = (props: Props) => {
const { _key: key, updateSettingValue, inputType, inputStyle, fieldValue, fonts } = props;
const [hoveredFont, setHoveredFont] = useState('');
const [inputText, setInputText] = useState('');
const areFontsLoading = fonts.length === 0;
Expand Down Expand Up @@ -55,7 +64,7 @@ const FontSearch = (props: any) => {
<input
type={inputType}
style={inputStyle}
value={settings[key]}
value={fieldValue}
id={key}
onChange={(event: any) => {
onTextChange(event);
Expand Down

0 comments on commit 9832a9e

Please sign in to comment.