5.4.0 Release Bug Fixes (#2789)

* fix: addresses CORL-848

Fixed copy for new commenters feature.

* fix: address CORL-847

Revert the line hight changes on select fields for now.

* fix: addressed CORL-851

Changed copy on CSS field.

* fix: addressed CORL-840

Changed deletion window to 24 hours.
Refactored durations to use TIME enum.
This commit is contained in:
Wyatt Johnson
2020-01-14 16:39:21 +00:00
committed by GitHub
parent a88644d98e
commit 9b8ab6de5f
36 changed files with 1061 additions and 1063 deletions
@@ -24,7 +24,7 @@ it("renders correctly with specified units", () => {
value: "",
disabled: false,
onChange: noop,
units: [DURATION_UNIT.SECONDS, DURATION_UNIT.HOURS],
units: [DURATION_UNIT.SECOND, DURATION_UNIT.HOUR],
};
const renderer = createRenderer();
renderer.render(<DurationField {...props} />);
@@ -37,7 +37,7 @@ it("use best matching unit", () => {
value: "3600",
disabled: false,
onChange: noop,
units: [DURATION_UNIT.SECONDS, DURATION_UNIT.MINUTES, DURATION_UNIT.HOURS],
units: [DURATION_UNIT.SECOND, DURATION_UNIT.MINUTE, DURATION_UNIT.HOUR],
};
const renderer = createRenderer();
renderer.render(<DurationField {...props} />);
@@ -50,7 +50,7 @@ it("use initial unit if 0", () => {
value: "0",
disabled: false,
onChange: noop,
units: [DURATION_UNIT.SECONDS, DURATION_UNIT.MINUTES, DURATION_UNIT.HOURS],
units: [DURATION_UNIT.SECOND, DURATION_UNIT.MINUTE, DURATION_UNIT.HOUR],
};
const renderer = createRenderer();
renderer.render(<DurationField {...props} />);
@@ -63,7 +63,7 @@ it("accepts invalid input", () => {
value: "this is so invalid",
disabled: false,
onChange: noop,
units: [DURATION_UNIT.SECONDS, DURATION_UNIT.MINUTES, DURATION_UNIT.HOURS],
units: [DURATION_UNIT.SECOND, DURATION_UNIT.MINUTE, DURATION_UNIT.HOUR],
};
const renderer = createRenderer();
renderer.render(<DurationField {...props} />);
@@ -8,7 +8,7 @@ import React, {
useState,
} from "react";
import { UNIT } from "coral-common/helpers/i18n";
import TIME from "coral-common/time";
import { Flex } from "coral-ui/components";
import { Option, SelectField } from "../SelectField";
@@ -20,32 +20,32 @@ import styles from "./DurationField.css";
* DURATION_UNIT are units that can be used in the
* DurationField components.
*/
export const DURATION_UNIT = UNIT;
export const DURATION_UNIT = TIME;
const DURATION_UNIT_MAP = {
[DURATION_UNIT.SECONDS]: "second",
[DURATION_UNIT.MINUTES]: "minute",
[DURATION_UNIT.HOURS]: "hour",
[DURATION_UNIT.DAYS]: "day",
[DURATION_UNIT.WEEKS]: "week",
[DURATION_UNIT.SECOND]: "second",
[DURATION_UNIT.MINUTE]: "minute",
[DURATION_UNIT.HOUR]: "hour",
[DURATION_UNIT.DAY]: "day",
[DURATION_UNIT.WEEK]: "week",
};
interface Props extends Pick<TextFieldProps, "color" | "name" | "disabled"> {
value: string;
onChange: (v: string) => void;
/** Specifiy units to include */
units?: ReadonlyArray<UNIT>;
units?: ReadonlyArray<TIME>;
}
function convertToSeconds(value: string, unit?: UNIT) {
function convertToSeconds(value: string, unit?: TIME) {
const parsed = parseInt(value, 10);
return (isNaN(parsed) || !unit ? value : parsed * unit).toString();
}
function convertFromSeconds(
value: string,
units: ReadonlyArray<UNIT>,
unit?: UNIT
units: ReadonlyArray<TIME>,
unit?: TIME
) {
const parsed = parseInt(value, 10);
@@ -77,7 +77,7 @@ function convertFromSeconds(
*/
const DurationField: FunctionComponent<Props> = ({
value,
units = [UNIT.HOURS, UNIT.DAYS, UNIT.WEEKS],
units = [TIME.HOUR, TIME.DAY, TIME.WEEK],
onChange,
disabled,
name,
@@ -25,7 +25,7 @@
font-family: var(--v2-font-family-primary);
font-weight: var(--v2-font-weight-primary-regular);
font-size: var(--v2-font-size-3);
line-height: var(--v2-line-height-tall);
line-height: var(--v2-line-height-reset);
appearance: none;
outline: none;
color: var(--v2-palette-input-value);
-1
View File
@@ -277,7 +277,6 @@ const variables2 = {
bodyShort: 1.3,
reset: 1,
title: 1.15,
tall: 1.3,
},
fontSize: {
1: "0.75rem",