Skip to content

Commit

Permalink
updates based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
bigfishdesign13 committed Oct 10, 2023
1 parent aa6750c commit 594edf8
Show file tree
Hide file tree
Showing 9 changed files with 134 additions and 104 deletions.
25 changes: 2 additions & 23 deletions src/components/DatePicker/DatePicker.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { ArgTypes, Canvas, Description, Meta, Source } from "@storybook/blocks";

import ComponentChangelogTable from "../../utils/ComponentChangelogTable";
import * as DatePickerStories from "./DatePicker.stories";
import { changelogData } from "./datePickerChangelogData";
import Link from "../Link/Link";
import Table from "../Table/Table";
import ComponentChangelogTable from "../../utils/ComponentChangelogTable";

<Meta of={DatePickerStories} />

Expand Down Expand Up @@ -258,26 +259,4 @@ const onSubmit = () => {

## Changelog

export const changelogData = [
{
date: "???",
version: "Prerelease",
type: "Update",
affects: "Accessibility",
notes: [
"Updates to pass a secondaryHelperTextId to its TextInput if needed so that the aria-describedby value can be associated with all relevant helperTexts.",
"Updates so that focus remains on input after value is changed.",
],
},
{
date: "2023-9-28",
version: "2.0.0",
type: "Update",
affects: "Styles",
notes: [
"Applied Typo2023 styles, including font size, font color, and text link patterns.",
],
},
];

<ComponentChangelogTable changelogData={changelogData} />
29 changes: 29 additions & 0 deletions src/components/DatePicker/datePickerChangelogData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/** This data is used to populate the ComponentChangelogTable component.
*
* date: string (when adding new entry during development, set value as "Prerelease")
* version: string (when adding new entry during development, set value as "Prerelease")
* type: "Bug Fix" | "New Feature" | "Update";
* affects: "Accessibility" | "Documentation" | "Functionality" | "Styles";
* notes: array (will render as a bulleted list, add one array element for each list element)
*/
export const changelogData = [
{
date: "Prerelease",
version: "Prerelease",
type: "Update",
affects: "Accessibility",
notes: [
"Updates to pass a secondaryHelperTextId to its TextInput if needed so that the aria-describedby value can be associated with all relevant helperTexts.",
"Updates so that focus remains on input after value is changed.",
],
},
{
date: "2023-9-28",
version: "2.0.0",
type: "Update",
affects: "Styles",
notes: [
"Applied Typo2023 styles, including font size, font color, and text link patterns.",
],
},
];
24 changes: 2 additions & 22 deletions src/components/FeedbackBox/FeedbackBox.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { ArgTypes, Canvas, Description, Meta, Source } from "@storybook/blocks";

import ComponentChangelogTable from "../../utils/ComponentChangelogTable";
import * as FeedbackBoxStories from "./FeedbackBox.stories";
import { changelogData } from "./feedbackBoxChangelogData";
import Link from "../Link/Link";
import ComponentChangelogTable from "../../utils/ComponentChangelogTable";

<Meta of={FeedbackBoxStories} />

Expand Down Expand Up @@ -388,25 +389,4 @@ const MyComponent = () => {

## Changelog

export const changelogData = [
{
date: "???",
version: "Prerelease",
type: "Update",
affects: "Accessibility, Styles",
notes: [
"Remove the underline on the component's `Privacy Policy` link.",
],
},
{
date: "2023-9-28",
version: "2.0.0",
type: "Update",
affects: "Styles",
notes: [
"Applied Typo2023 styles, including font size, font color, and text link patterns.",
],
},
];

<ComponentChangelogTable changelogData={changelogData} />
26 changes: 26 additions & 0 deletions src/components/FeedbackBox/feedbackBoxChangelogData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/** This data is used to populate the ComponentChangelogTable component.
*
* date: string (when adding new entry during development, set value as "Prerelease")
* version: string (when adding new entry during development, set value as "Prerelease")
* type: "Bug Fix" | "New Feature" | "Update";
* affects: "Accessibility" | "Documentation" | "Functionality" | "Styles";
* notes: array (will render as a bulleted list, add one array element for each list element)
*/
export const changelogData = [
{
date: "Prerelease",
version: "Prerelease",
type: "Update",
affects: "Accessibility, Styles",
notes: ["Remove the underline on the component's `Privacy Policy` link."],
},
{
date: "2023-9-28",
version: "2.0.0",
type: "Update",
affects: "Styles",
notes: [
"Applied Typo2023 styles, including font size, font color, and text link patterns.",
],
},
];
24 changes: 2 additions & 22 deletions src/components/Hero/Hero.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { ArgTypes, Canvas, Description, Meta, Source } from "@storybook/blocks";

import ComponentChangelogTable from "../../utils/ComponentChangelogTable";
import * as HeroStories from "./Hero.stories";
import { changelogData } from "./heroChangelogData";
import Link from "../Link/Link";
import ComponentChangelogTable from "../../utils/ComponentChangelogTable";

<Meta of={HeroStories} />

Expand Down Expand Up @@ -202,25 +203,4 @@ and `"secondaryWhatsOn"`.

## Changelog

export const changelogData = [
{
date: "???",
version: "Prerelease",
type: "Bug Fix",
affects: "Functionality",
notes: [
"Fixes an issue with `backgroundColor` and `foregroundColor` props not prioritizing the passed design token values for the `Hero` component.",
],
},
{
date: "2023-9-28",
version: "2.0.0",
type: "Update",
affects: "Styles",
notes: [
"Applied Typo2023 styles, including font size, font color, and text link patterns.",
],
},
];

<ComponentChangelogTable changelogData={changelogData} />
28 changes: 28 additions & 0 deletions src/components/Hero/heroChangelogData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/** This data is used to populate the ComponentChangelogTable component.
*
* date: string (when adding new entry during development, set value as "Prerelease")
* version: string (when adding new entry during development, set value as "Prerelease")
* type: "Bug Fix" | "New Feature" | "Update";
* affects: "Accessibility" | "Documentation" | "Functionality" | "Styles";
* notes: array (will render as a bulleted list, add one array element for each list element)
*/
export const changelogData = [
{
date: "Prerelease",
version: "Prerelease",
type: "Bug Fix",
affects: "Functionality",
notes: [
"Fixes an issue with `backgroundColor` and `foregroundColor` props not prioritizing the passed design token values for the `Hero` component.",
],
},
{
date: "2023-9-28",
version: "2.0.0",
type: "Update",
affects: "Styles",
notes: [
"Applied Typo2023 styles, including font size, font color, and text link patterns.",
],
},
] as const;
22 changes: 2 additions & 20 deletions src/components/Slider/Slider.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { ArgTypes, Canvas, Description, Meta, Source } from "@storybook/blocks";

import ComponentChangelogTable from "../../utils/ComponentChangelogTable";
import * as SliderStories from "./Slider.stories";
import { changelogData } from "./sliderChangelogData";
import Link from "../Link/Link";
import ComponentChangelogTable from "../../utils/ComponentChangelogTable";

<Meta of={SliderStories} />

Expand Down Expand Up @@ -335,23 +336,4 @@ function RangeSliderValuesUpdateExample() {

## Changelog

export const changelogData = [
{
date: "???",
version: "Prerelease",
type: "Bug Fix",
affects: "Functionality",
notes: [
"Updated to use appropriate aria-label values for the slider thumbs and text input fields.",
],
},
{
date: "2023-9-28",
version: "2.0.0",
type: "Update",
affects: "Styles",
notes: ["Applied Typo2023 styles, including font size and font color."],
},
];

<ComponentChangelogTable changelogData={changelogData} />
26 changes: 26 additions & 0 deletions src/components/Slider/sliderChangelogData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/** This data is used to populate the ComponentChangelogTable component.
*
* date: string (when adding new entry during development, set value as "Prerelease")
* version: string (when adding new entry during development, set value as "Prerelease")
* type: "Bug Fix" | "New Feature" | "Update";
* affects: "Accessibility" | "Documentation" | "Functionality" | "Styles";
* notes: array (will render as a bulleted list, add one array element for each list element)
*/
export const changelogData = [
{
date: "Prerelease",
version: "Prerelease",
type: "Bug Fix",
affects: "Functionality",
notes: [
"Updated to use appropriate aria-label values for the slider thumbs and text input fields.",
],
},
{
date: "2023-9-28",
version: "2.0.0",
type: "Update",
affects: "Styles",
notes: ["Applied Typo2023 styles, including font size and font color."],
},
];
34 changes: 17 additions & 17 deletions src/utils/ComponentChangelogTable.tsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
import { PropsWithChildren } from "react";

import List from "../components/List/List";
import Table from "../components/Table/Table";

export interface ComponentChangelogTableProps {
changelogData: any[];
}
export interface TableRowProps {
export interface ChangelogData {
date: string;
version: string;
type: "Bug Fix" | "New Feature" | "Update";
affects: "Accessibility" | "Documentation" | "Functionality" | "Styles";
notes: any[];
notes: string[];
}

export interface ComponentChangelogTableProps {
changelogData: ChangelogData[];
}

export const ComponentChangelogTable = (
props: PropsWithChildren<ComponentChangelogTableProps>
props: ComponentChangelogTableProps
) => {
const { changelogData } = props;
const tableData = [];

changelogData.forEach((tableRow: PropsWithChildren<TableRowProps>) => {
const tableData = changelogData.map((tableRow: ChangelogData) => {
const { date, version, type, affects, notes } = tableRow;
const dateFormatted = new Date(date).toLocaleDateString("en-us", {
year: "numeric",
month: "short",
day: "numeric",
});
const dateFormatted =
date === "Prerelease"
? date
: new Date(date).toLocaleDateString("en-us", {
year: "numeric",
month: "short",
day: "numeric",
});
const notesItems = notes.map((item, i) => <li key={i}>{item}</li>);
const notesList = <List type="ul">{notesItems}</List>;
const rowData = [dateFormatted, version, type, affects, notesList];
tableData.push(rowData);
return rowData;
});

const headersData = ["Date", "Version", "Type", "Affects", "Notes"];
Expand Down

0 comments on commit 594edf8

Please sign in to comment.