Skip to content

Commit

Permalink
Merge pull request #10 from honjow/dev
Browse files Browse the repository at this point in the history
 Fix the margin issue.
  • Loading branch information
aarron-lee authored Feb 28, 2024
2 parents 7fcb556 + 1975772 commit e165893
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 42 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ out/*
cli/
cli/*
cli/decky
Makefile
29 changes: 15 additions & 14 deletions src/components/HhdComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ import HhdDropdown from "./HhdDropdown";
import HhdModesDropdown from "./HhdModesDropdown";
import { useUpdateHhdStatePending } from "../hooks/controller";
import HhdIntSlider from "./HhdIntSlider";
import HhdDeckyVersion from "./HhdDeckyVersion";
import ArrowToggleButton from "./ArrowToggleButton";
import ErrorBoundary from "./ErrorBoundary";
// import { getLogInfo } from "../backend/utils";

const noop = () => {};
const noop = () => { };

interface HhdComponentType extends SettingsType {
renderChild?: any;
Expand Down Expand Up @@ -142,18 +141,20 @@ const HhdComponent: VFC<HhdComponentType> = ({
// toggle component
const checked = get(state, `${statePath}`, defaultValue);
return (
<ToggleField
label={title}
checked={Boolean(checked)}
onChange={(enabled) => {
if (updating) {
return;
}
return updateState(`${statePath}`, enabled);
}}
disabled={updating}
{...otherProps}
/>
<PanelSectionRow>
<ToggleField
label={title}
checked={Boolean(checked)}
onChange={(enabled) => {
if (updating) {
return;
}
return updateState(`${statePath}`, enabled);
}}
disabled={updating}
{...otherProps}
/>
</PanelSectionRow>
);
}

Expand Down
40 changes: 21 additions & 19 deletions src/components/HhdDropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DropdownItem } from "decky-frontend-lib";
import { DropdownItem, PanelSectionRow } from "decky-frontend-lib";
import { FC } from "react";

type DropdownProps = {
Expand Down Expand Up @@ -29,24 +29,26 @@ const HhdDropdown: FC<DropdownProps> = ({
});

return (
<DropdownItem
label={title}
description={hint}
rgOptions={dropdownOptions.map((o) => {
return {
data: o.data,
label: o.label,
value: o.value,
};
})}
selectedOption={
dropdownOptions.find((o) => {
return o.data === selectedValue;
})?.data || defaultValue
}
onChange={onChange}
{...otherProps}
/>
<PanelSectionRow>
<DropdownItem
label={title}
description={hint}
rgOptions={dropdownOptions.map((o) => {
return {
data: o.data,
label: o.label,
value: o.value,
};
})}
selectedOption={
dropdownOptions.find((o) => {
return o.data === selectedValue;
})?.data || defaultValue
}
onChange={onChange}
{...otherProps}
/>
</PanelSectionRow>
);
};

Expand Down
6 changes: 3 additions & 3 deletions src/components/HhdIntSlider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC, useState } from "react";
import { SliderField } from "decky-frontend-lib";
import { PanelSectionRow, SliderField } from "decky-frontend-lib";

type PropType = {
value: number;
Expand Down Expand Up @@ -31,7 +31,7 @@ const HhdIntSlider: FC<PropType> = ({
};

return (
<>
<PanelSectionRow>
<SliderField
label={title}
value={sliderValue}
Expand All @@ -44,7 +44,7 @@ const HhdIntSlider: FC<PropType> = ({
{...extraProps}
{...otherProps}
/>
</>
</PanelSectionRow>
);
};

Expand Down
6 changes: 3 additions & 3 deletions src/components/HhdModesDropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DropdownItem } from "decky-frontend-lib";
import { DropdownItem, PanelSectionRow } from "decky-frontend-lib";
import { FC } from "react";

type DropdownProps = {
Expand Down Expand Up @@ -44,7 +44,7 @@ const HhdModesDropdown: FC<DropdownProps> = ({
const children = currentMode ? Object.entries(currentMode.children) : [];

return (
<>
<PanelSectionRow>
<DropdownItem
label={title}
description={hint}
Expand Down Expand Up @@ -83,7 +83,7 @@ const HhdModesDropdown: FC<DropdownProps> = ({
otherProps: additionalProps,
});
})}
</>
</PanelSectionRow>
);
};

Expand Down
6 changes: 3 additions & 3 deletions src/components/HhdSlider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC } from "react";
import { SliderField, NotchLabel } from "decky-frontend-lib";
import { SliderField, NotchLabel, PanelSectionRow } from "decky-frontend-lib";

type PropType = {
value: number;
Expand Down Expand Up @@ -34,7 +34,7 @@ const HhdSlider: FC<PropType> = ({
options.indexOf(value) >= 0 ? options.indexOf(value) : defaultValue;

return (
<>
<PanelSectionRow>
<SliderField
label={title}
value={sliderValue}
Expand All @@ -49,7 +49,7 @@ const HhdSlider: FC<PropType> = ({
{...otherProps}
{...extraProps}
/>
</>
</PanelSectionRow>
);
};

Expand Down

0 comments on commit e165893

Please sign in to comment.