-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
22079: Added additional PropertyLabels and Icons, MINOR (#34)
- Loading branch information
1 parent
8811147
commit 8f3c6c4
Showing
21 changed files
with
206 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { FC } from "react"; | ||
import { PropertyLabel, type PropertyLabelProps } from "./PropertyLabel"; | ||
|
||
export const FeatureLabel: FC<Omit<PropertyLabelProps, "property">> = ( | ||
props, | ||
) => <PropertyLabel {...props} property={"feature"} />; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { FC } from "react"; | ||
import { PropertyLabel, type PropertyLabelProps } from "./PropertyLabel"; | ||
|
||
export const FeaturesLabel: FC<Omit<PropertyLabelProps, "property">> = ( | ||
props, | ||
) => <PropertyLabel {...props} property={"features"} />; |
6 changes: 6 additions & 0 deletions
6
src/components/DataDisplay/PropertyLabels/LastTrainingDurationLabel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { FC } from "react"; | ||
import { PropertyLabel, type PropertyLabelProps } from "./PropertyLabel"; | ||
|
||
export const LastTrainingDurationLabel: FC< | ||
Omit<PropertyLabelProps, "property"> | ||
> = (props) => <PropertyLabel {...props} property={"lastTrainingDuration"} />; |
6 changes: 6 additions & 0 deletions
6
src/components/DataDisplay/PropertyLabels/LastTrainingEndedLabel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { FC } from "react"; | ||
import { PropertyLabel, type PropertyLabelProps } from "./PropertyLabel"; | ||
|
||
export const LastTrainingEndedLabel: FC< | ||
Omit<PropertyLabelProps, "property"> | ||
> = (props) => <PropertyLabel {...props} property={"lastTrainingEnded"} />; |
6 changes: 6 additions & 0 deletions
6
src/components/DataDisplay/PropertyLabels/LastTrainingStartedLabel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { FC } from "react"; | ||
import { PropertyLabel, type PropertyLabelProps } from "./PropertyLabel"; | ||
|
||
export const LastTrainingStartedLabel: FC< | ||
Omit<PropertyLabelProps, "property"> | ||
> = (props) => <PropertyLabel {...props} property={"lastTrainingStarted"} />; |
6 changes: 6 additions & 0 deletions
6
src/components/DataDisplay/PropertyLabels/NumberOfCasesLabel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { FC } from "react"; | ||
import { PropertyLabel, type PropertyLabelProps } from "./PropertyLabel"; | ||
|
||
export const NumberOfCasesLabel: FC<Omit<PropertyLabelProps, "property">> = ( | ||
props, | ||
) => <PropertyLabel {...props} property={"numberOfCases"} />; |
6 changes: 6 additions & 0 deletions
6
src/components/DataDisplay/PropertyLabels/NumberOfFeaturesLabel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { FC } from "react"; | ||
import { PropertyLabel, type PropertyLabelProps } from "./PropertyLabel"; | ||
|
||
export const NumberOfFeaturesLabel: FC<Omit<PropertyLabelProps, "property">> = ( | ||
props, | ||
) => <PropertyLabel {...props} property={"numberOfFeatures"} />; |
15 changes: 15 additions & 0 deletions
15
src/components/DataDisplay/PropertyLabels/PropertyLabel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { ComponentProps, FC } from "react"; | ||
import { useTranslation } from "react-i18next"; | ||
import { EnginePropertyLabelsI18nBundle as i18n } from "./i18n"; | ||
|
||
export type PropertyLabelProps = ComponentProps<"span"> & { | ||
property: keyof typeof i18n.strings; | ||
}; | ||
export const PropertyLabel: FC<PropertyLabelProps> = ({ | ||
property, | ||
...props | ||
}) => { | ||
const { t } = useTranslation(i18n.namespace); | ||
|
||
return <span {...props}>{t(i18n.strings[property])}</span>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { FC } from "react"; | ||
import { PropertyLabel, type PropertyLabelProps } from "./PropertyLabel"; | ||
|
||
export const SourceLabel: FC<Omit<PropertyLabelProps, "property">> = ( | ||
props, | ||
) => <PropertyLabel {...props} property={"source"} />; |
6 changes: 6 additions & 0 deletions
6
src/components/DataDisplay/PropertyLabels/SourceTypeLabel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { FC } from "react"; | ||
import { PropertyLabel, type PropertyLabelProps } from "./PropertyLabel"; | ||
|
||
export const SourceTypeLabel: FC<Omit<PropertyLabelProps, "property">> = ( | ||
props, | ||
) => <PropertyLabel {...props} property={"sourceType"} />; |
6 changes: 6 additions & 0 deletions
6
src/components/DataDisplay/PropertyLabels/TimeSeriesLabel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { FC } from "react"; | ||
import { PropertyLabel, type PropertyLabelProps } from "./PropertyLabel"; | ||
|
||
export const TimeSeriesLabel: FC<Omit<PropertyLabelProps, "property">> = ( | ||
props, | ||
) => <PropertyLabel {...props} property={"timeSeries"} />; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { | ||
getStringsForI18nBundleFromResource, | ||
I18nBundle, | ||
} from "@howso/ui-internationalization-utils"; | ||
import { Languages } from "../../../constants"; | ||
|
||
const namespace = "EnginePropertyLabels"; | ||
|
||
const en = { | ||
feature: "Feature", | ||
features: "Features", | ||
lastTrainingStarted: "Last trained started", | ||
lastTrainingEnded: "Last training end", | ||
lastTrainingDuration: "Last training duration", | ||
numberOfFeatures: "Number of features", | ||
numberOfCases: "Number of cases", | ||
sourceType: "Source type", | ||
source: "Source", | ||
timeSeries: "Time series", | ||
}; | ||
|
||
type Resource = typeof en; | ||
|
||
export const EnginePropertyLabelsI18nBundle: I18nBundle<Languages, Resource> = { | ||
namespace, | ||
resources: { en }, | ||
strings: getStringsForI18nBundleFromResource<Resource>(en), | ||
}; |
53 changes: 53 additions & 0 deletions
53
src/components/DataDisplay/PropertyLabels/index.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { | ||
FeatureLabel, | ||
FeaturesLabel, | ||
LastTrainingDurationLabel, | ||
LastTrainingEndedLabel, | ||
LastTrainingStartedLabel, | ||
NumberOfCasesLabel, | ||
NumberOfFeaturesLabel, | ||
PropertyLabelProps, | ||
SourceLabel, | ||
SourceTypeLabel, | ||
TimeSeriesLabel, | ||
} from "."; | ||
|
||
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export | ||
const meta: Meta<PropertyLabelProps> = { | ||
title: "Components/DataDisplay/PropertyLabels", | ||
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/7.0/react/writing-docs/docs-page | ||
// tags: ["autodocs"], | ||
parameters: { | ||
// More on Story layout: https://storybook.js.org/docs/react/configure/story-layout | ||
layout: "centered", | ||
}, | ||
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes | ||
argTypes: {}, | ||
args: { | ||
className: "", | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<PropertyLabelProps>; | ||
|
||
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args | ||
export const Default: Story = { | ||
// More on args: https://storybook.js.org/docs/react/writing-stories/args | ||
args: {}, | ||
render: (args) => ( | ||
<div className="flex flex-col gap-1"> | ||
<FeatureLabel {...args} /> | ||
<FeaturesLabel {...args} /> | ||
<LastTrainingStartedLabel {...args} /> | ||
<LastTrainingEndedLabel {...args} /> | ||
<LastTrainingDurationLabel {...args} /> | ||
<NumberOfCasesLabel {...args} /> | ||
<NumberOfFeaturesLabel {...args} /> | ||
<SourceLabel {...args} /> | ||
<SourceTypeLabel {...args} /> | ||
<TimeSeriesLabel {...args} /> | ||
</div> | ||
), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export * from ".//LastTrainingDurationLabel"; | ||
export * from "./FeatureLabel"; | ||
export * from "./FeaturesLabel"; | ||
export * from "./i18n"; | ||
export * from "./LastTrainingEndedLabel"; | ||
export * from "./LastTrainingStartedLabel"; | ||
export * from "./NumberOfCasesLabel"; | ||
export * from "./NumberOfFeaturesLabel"; | ||
export * from "./PropertyLabel"; | ||
export * from "./SourceLabel"; | ||
export * from "./SourceTypeLabel"; | ||
export * from "./TimeSeriesLabel"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Languages } from "@howso/react-tailwind-flowbite-components"; | ||
import { I18nBundle } from "@howso/ui-internationalization-utils"; | ||
import { EnginePropertyLabelsI18nBundle } from "./PropertyLabels"; | ||
|
||
export * from "./PropertyLabels"; | ||
|
||
export const DataDisplayI18nBundles: I18nBundle<Languages, any>[] = [ | ||
EnginePropertyLabelsI18nBundle, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import type { FC } from "react"; | ||
import { type IconBaseProps } from "react-icons"; | ||
import { HiLightBulb } from "react-icons/hi"; | ||
|
||
export const InsightsIcon: FC<IconBaseProps> = (props) => ( | ||
<HiLightBulb {...props} /> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import type { FC } from "react"; | ||
import { type IconBaseProps } from "react-icons"; | ||
import { HiDocumentDuplicate } from "react-icons/hi"; | ||
|
||
export const SynthesisIcon: FC<IconBaseProps> = (props) => ( | ||
<HiDocumentDuplicate {...props} /> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from "./DataDisplay"; | ||
export * from "./FeatureAttributes"; | ||
export * from "./Icons"; | ||
export * from "./Trainee"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters