Skip to content

Commit

Permalink
rename component
Browse files Browse the repository at this point in the history
  • Loading branch information
macfarlandian committed Jun 5, 2021
1 parent be69ab7 commit e75adcb
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ type VerticallyExpandableProps = {
};

/**
* A container that expands smoothly to the height of its children
* A container that transitions smoothly to the height of its children
* as they change size.
*/
export const VerticallyExpandable: React.FC<VerticallyExpandableProps> = ({
export const AutoHeightTransition: React.FC<VerticallyExpandableProps> = ({
children,
initialHeight = 0,
}) => {
Expand Down
2 changes: 1 addition & 1 deletion spotlight-client/src/UiLibrary/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// =============================================================================

export { default as animation } from "./animation";
export * from "./AutoHeightTransition";
export { default as breakpoints } from "./breakpoints";
export { default as Check } from "./Check";
export * from "./Checkbox";
Expand All @@ -31,5 +32,4 @@ export * from "./PageSection";
export { default as PageTitle } from "./PageTitle";
export * from "./typography";
export * from "./UnStyledButton";
export * from "./VerticallyExpandable";
export { default as zIndex } from "./zIndex";
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { useHighlightedItem } from "../charts/utils";
import DemographicsByCategoryMetric from "../contentModels/DemographicsByCategoryMetric";
import DemographicFilterSelect from "../DemographicFilterSelect";
import MetricVizControls from "../MetricVizControls";
import { animation, VerticallyExpandable, zIndex } from "../UiLibrary";
import { animation, AutoHeightTransition, zIndex } from "../UiLibrary";
import VizNotes from "../VizNotes";
import withMetricHydrator from "../withMetricHydrator";

Expand Down Expand Up @@ -73,7 +73,7 @@ const VizDemographicsByCategory: React.FC<VizDemographicsByCategoryProps> = ({
filters={[<DemographicFilterSelect metric={metric} />]}
metric={metric}
/>
<VerticallyExpandable initialHeight={bubbleChartHeight}>
<AutoHeightTransition initialHeight={bubbleChartHeight}>
{chartTransitions.map(({ item, key, props }) => (
<ChartWrapper key={key}>
<animated.div style={props}>
Expand Down Expand Up @@ -114,7 +114,7 @@ const VizDemographicsByCategory: React.FC<VizDemographicsByCategoryProps> = ({
</animated.div>
</ChartWrapper>
))}
</VerticallyExpandable>
</AutoHeightTransition>
<VizNotes smallData unknowns={unknowns} />
</>
);
Expand Down
6 changes: 3 additions & 3 deletions spotlight-client/src/VizNotes/UnknownsNote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { ValuesType } from "utility-types";
import { UnknownCounts, Unknowns } from "../contentModels/types";
import { getDemographicViewLabel } from "../demographics";
import { DemographicFieldKeyList } from "../metricsApi";
import { VerticallyExpandable } from "../UiLibrary";
import { AutoHeightTransition } from "../UiLibrary";
import { formatAsNumber } from "../utils";

const COLLAPSED_LIMIT = 3;
Expand Down Expand Up @@ -106,11 +106,11 @@ type UnknownsNoteProps = {

export const UnknownsNote = ({ unknowns }: UnknownsNoteProps): JSX.Element => {
return (
<VerticallyExpandable>
<AutoHeightTransition>
This data includes some individuals for whom age, gender, or
race/ethnicity is not reported. These individuals count toward the total
but are excluded from demographic breakdown views. Unknown values
comprise: {useFormattedUnknowns(unknowns)}.
</VerticallyExpandable>
</AutoHeightTransition>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import DemographicsByCategoryMetric from "../contentModels/DemographicsByCategor
import DemographicFilterSelect from "../DemographicFilterSelect";
import MetricVizControls from "../MetricVizControls";
import { prisonStayLengthFields } from "../metricsApi";
import { animation, VerticallyExpandable } from "../UiLibrary";
import { animation, AutoHeightTransition } from "../UiLibrary";
import withMetricHydrator from "../withMetricHydrator";
import VizNotes from "../VizNotes";

Expand Down Expand Up @@ -91,7 +91,7 @@ const VizPrisonStayLengths: React.FC<VizPrisonStayLengthsProps> = ({
filters={[<DemographicFilterSelect metric={metric} />]}
metric={metric}
/>
<VerticallyExpandable initialHeight={singleChartHeight}>
<AutoHeightTransition initialHeight={singleChartHeight}>
<ChartsWrapper>
{chartTransitions.map(({ item, key, props }) => (
<animated.div key={key} style={props}>
Expand All @@ -108,7 +108,7 @@ const VizPrisonStayLengths: React.FC<VizPrisonStayLengthsProps> = ({
</animated.div>
))}
</ChartsWrapper>
</VerticallyExpandable>
</AutoHeightTransition>
<VizNotes smallData unknowns={unknowns} />
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
import RecidivismRateMetric from "../contentModels/RecidivismRateMetric";
import DemographicFilterSelect from "../DemographicFilterSelect";
import MetricVizControls from "../MetricVizControls";
import { animation, VerticallyExpandable } from "../UiLibrary";
import { animation, AutoHeightTransition } from "../UiLibrary";
import { formatAsNumber, formatAsPct } from "../utils";
import VizNotes from "../VizNotes";
import withMetricHydrator from "../withMetricHydrator";
Expand Down Expand Up @@ -127,7 +127,7 @@ const VizRecidivismRateSingleFollowup: React.FC<VizRecidivismRateSingleFollowupP
]}
metric={metric}
/>
<VerticallyExpandable initialHeight={singleChartHeight}>
<AutoHeightTransition initialHeight={singleChartHeight}>
<ChartsWrapper ref={measureRef}>
{chartTransitions.map(({ item, key, props }) => (
<animated.div key={key} style={props}>
Expand All @@ -146,7 +146,7 @@ const VizRecidivismRateSingleFollowup: React.FC<VizRecidivismRateSingleFollowupP
</animated.div>
))}
</ChartsWrapper>
</VerticallyExpandable>
</AutoHeightTransition>
<VizNotes smallData unknowns={unknowns} />
</>
)}
Expand Down

0 comments on commit e75adcb

Please sign in to comment.