From e7e3a6d4d966bf005a80a81329ca48cf9c230a77 Mon Sep 17 00:00:00 2001 From: Rem0o Date: Fri, 19 Apr 2024 12:01:40 -0400 Subject: [PATCH] Use Border component --- src/reactComponents/border.tsx | 19 +++++++++ src/reactComponents/docs/customSensors.tsx | 29 ++++++++------ src/reactComponents/docs/docSection.tsx | 8 +--- src/reactComponents/docs/fanCurves.tsx | 46 +++++++++++----------- src/reactComponents/niceHeader.tsx | 19 ++++++++- src/reactPages/docs.tsx | 2 +- src/reactPages/index.tsx | 37 ++++++++--------- 7 files changed, 98 insertions(+), 62 deletions(-) create mode 100644 src/reactComponents/border.tsx diff --git a/src/reactComponents/border.tsx b/src/reactComponents/border.tsx new file mode 100644 index 0000000..b5229ad --- /dev/null +++ b/src/reactComponents/border.tsx @@ -0,0 +1,19 @@ +import { twMerge } from "tailwind-merge"; + +const defaultClass = "rounded-2xl border border-body-300 p-4"; + +const Border = ( + props: React.DetailedHTMLProps< + React.HTMLAttributes, + HTMLDivElement + > +) => { + const { children, className, ...restOfProps } = props; + return ( +
+ {children} +
+ ); +}; + +export default Border; \ No newline at end of file diff --git a/src/reactComponents/docs/customSensors.tsx b/src/reactComponents/docs/customSensors.tsx index 7193093..75d8b9c 100644 --- a/src/reactComponents/docs/customSensors.tsx +++ b/src/reactComponents/docs/customSensors.tsx @@ -1,5 +1,8 @@ +import type consts from "../../common/consts"; import icons from "../../common/icons"; -import { type DocSection, parameters, ParametersCard } from "./docSection"; +import Border from "../border"; +import { NiceSmallerHeader } from "../niceHeader"; +import { type DocSection, parameters } from "./docSection"; const timeAverage: DocSection = { key: "Time Average", @@ -13,14 +16,14 @@ const timeAverage: DocSection = {


- -

Parameters:

+ +
  • Temperature source: {parameters.tempSource}
  • Time: Averaging period of the selected temperature source.
-
+ ); } @@ -38,8 +41,8 @@ const mixSensor: DocSection = {


- -

Parameters:

+ +
  • Function: {parameters.functions}
  • @@ -47,7 +50,7 @@ const mixSensor: DocSection = { Add sensor: Add any existing temperature sensor to the mix.{" "}
-
+ ); } @@ -67,13 +70,13 @@ const fileSensor: DocSection = {


- -

Parameters:

+ +
  • Path: Path of the sensor file.
-
+ ); } @@ -88,8 +91,8 @@ const offsetSensor: DocSection = {

The offset custom sensor allows to offset an existing sensor.


- -

Parameters:

+ +
  • @@ -100,7 +103,7 @@ const offsetSensor: DocSection = { (%) instead of absolute (degree).
-
+ ); } diff --git a/src/reactComponents/docs/docSection.tsx b/src/reactComponents/docs/docSection.tsx index 8f78761..ac9d3f7 100644 --- a/src/reactComponents/docs/docSection.tsx +++ b/src/reactComponents/docs/docSection.tsx @@ -1,5 +1,3 @@ -import Card from "../card"; - export type DocSection = { key: string; icon?: string; @@ -15,8 +13,4 @@ export const parameters = { "Hysteresis and response time parameters will be ignored as soon at the minimum or maximum temperature point set by the fan curve is hit. Hysteresis will apply when re-entering the set temperature range.", tempSource: "Source to use as input.", functions: "Choose between Max, Min, Average, Sum, Subtract." -}; - -export const ParametersCard = ({ children }: { children: React.ReactNode }) => { - return {children}; -}; +}; \ No newline at end of file diff --git a/src/reactComponents/docs/fanCurves.tsx b/src/reactComponents/docs/fanCurves.tsx index 2aa3a51..61e604e 100644 --- a/src/reactComponents/docs/fanCurves.tsx +++ b/src/reactComponents/docs/fanCurves.tsx @@ -1,4 +1,4 @@ -import { type DocSection, parameters, ParametersCard } from "./docSection"; +import { type DocSection, parameters } from "./docSection"; import MixFanCurveCard from "../demo/mixFanCurveCard"; import { createTempSource, @@ -10,6 +10,8 @@ import { useState } from "react"; import { useInterval } from "../../common/hooks"; import LinearFanCurveCard from "../demo/linearFanCurveCard"; import type { FanCurve, LinearFanCurveConfig } from "../demo/fanCurve"; +import Border from "../border"; +import { NiceSmallerHeader } from "../niceHeader"; const DocDemoLinearFanCurveCard = () => { const updateSources = (): [TemperatureSource, TemperatureSource] => [ @@ -62,8 +64,8 @@ const linear: DocSection = {
- -

Parameters:

+ +
  • @@ -85,7 +87,7 @@ const linear: DocSection = { {parameters.ignoreHysteresis}
-
+ ); } @@ -111,8 +113,8 @@ const graph: DocSection = {


- -

Parameters:

+ +
  • Temperature source: {parameters.tempSource}
  • @@ -126,7 +128,7 @@ const graph: DocSection = { {parameters.ignoreHysteresis}
-
+ ); } @@ -174,13 +176,13 @@ const flat: DocSection = {


- -

Parameters:

+ +
  • Fan speed %: Percent.
-
+ ); } @@ -200,8 +202,8 @@ const sync: DocSection = {


- -

Parameters:

+ +
  • Selected control: The control to sync with.
  • @@ -211,7 +213,7 @@ const sync: DocSection = { instead of absolute.
-
+ ); } @@ -232,13 +234,13 @@ const trigger: DocSection = {


- -

Parameters:

+ +
  • Response Time: {parameters.responseTime}
-
+ ); } @@ -260,14 +262,14 @@ const mix: DocSection = {


- -

Parameters:

+ +
  • Function: {parameters.functions}
  • Fan curves: Add any existing fan curve to the mix.
-
+ ); } @@ -293,8 +295,8 @@ const auto: DocSection = {


- -

Parameters:

+ +
  • @@ -316,7 +318,7 @@ const auto: DocSection = { temperature is decreasing.
-
+ ) }; diff --git a/src/reactComponents/niceHeader.tsx b/src/reactComponents/niceHeader.tsx index c89ef6b..b92d935 100644 --- a/src/reactComponents/niceHeader.tsx +++ b/src/reactComponents/niceHeader.tsx @@ -14,4 +14,21 @@ const NiceHeader = ({ icon, text }: { icon?: string; text: string }) => { ); }; -export default NiceHeader; +const NiceSmallerHeader = ({ icon, text }: { icon?: string; text: string }) => { + return ( +

+ {icon ? ( + + + + ) : ( + <> + )} + + {text} +

+ ); +}; + + +export { NiceHeader, NiceSmallerHeader }; diff --git a/src/reactPages/docs.tsx b/src/reactPages/docs.tsx index c373e9d..24b3306 100644 --- a/src/reactPages/docs.tsx +++ b/src/reactPages/docs.tsx @@ -17,7 +17,7 @@ import { auto } from "../reactComponents/docs/fanCurves"; import { SmallIcon } from "../reactComponents/icon"; -import NiceHeader from "../reactComponents/niceHeader"; +import { NiceHeader } from "../reactComponents/niceHeader"; import "./../styles/docs.css"; import { PageHeader } from "../reactComponents/pageHeader"; diff --git a/src/reactPages/index.tsx b/src/reactPages/index.tsx index ba96dc1..8bb5fa6 100644 --- a/src/reactPages/index.tsx +++ b/src/reactPages/index.tsx @@ -2,9 +2,9 @@ import { useEffect, useRef, useState } from "react"; import { InView } from "react-intersection-observer"; import consts from "../common/consts"; import icons from "../common/icons"; -import NiceHeader from "../reactComponents/niceHeader"; +import { NiceHeader } from "../reactComponents/niceHeader"; import Card from "../reactComponents/card"; -import { BigIcon, Icon } from "../reactComponents/icon"; +import { Icon } from "../reactComponents/icon"; import { useInterval, useRefreshState, @@ -29,6 +29,7 @@ import { DonationModal } from "../reactComponents/donationModal"; import { DownloadModal } from "../reactComponents/downloadModal"; import { versionInfo } from "../reactComponents/services/versionService"; +import Border from "../reactComponents/border"; type VersionInfo = { Number: number; @@ -198,7 +199,7 @@ export const IndexPage = () => {
-
+

" No third-party software, at all, as much as they might want to tout that they do, do not have this level of control. This is what @@ -215,7 +216,7 @@ export const IndexPage = () => { JayzTwoCents

-
+
@@ -254,7 +255,7 @@ export const IndexPage = () => {
-
+ { entity, and start thinking about cooling and noise as a system-wide concern.

-
+ -
+

- Fan Control has ALL the parameters. Fan calibration, response time, hysteresis, - hysteresis direction, step up, step down... Fine tune to your - heart's desire. Control your fan's start and stopping logic, for - smooth 0 RPM operation (when supported). + Fan Control has ALL the parameters. Fan calibration, response time, + hysteresis, hysteresis direction, step up, step down... Fine tune to + your heart's desire. Control your fan's start and stopping logic, + for smooth 0 RPM operation (when supported).

-
+ -
+ { > Try it out on the demo card!

-
+
-
+ { .

-
+ -
+ { may stop caring at some point. Combined with the plugin system, Fan Control is unlocked for many generations of hardware to come.

-
+
{showDonationModal ? (