Skip to content

Commit

Permalink
Limit each component description width up to 750px for readability (#…
Browse files Browse the repository at this point in the history
…1336)

* limit description width up to 750px

* export maxWidth from a common place
  • Loading branch information
tongyu-microsoft committed Apr 12, 2022
1 parent 9b16f86 commit aa18d00
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { descriptionMaxWidth } from "@responsible-ai/core-ui";
import {
IProcessedStyleSet,
IStyle,
Expand Down Expand Up @@ -42,6 +43,7 @@ export const CausalAggregateStyles: () => IProcessedStyleSet<ICausalAggregateSty
display: "inline-block",
flex: "1",
fontSize: 14,
maxWidth: descriptionMaxWidth,
paddingBottom: "5px",
textAlign: "left"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { descriptionMaxWidth } from "@responsible-ai/core-ui";
import {
IProcessedStyleSet,
IStyle,
Expand Down Expand Up @@ -37,6 +38,7 @@ export const CausalIndividualStyles: () => IProcessedStyleSet<ICausalIndividualS
display: "inline-block",
flex: "1",
fontSize: 14,
maxWidth: descriptionMaxWidth,
paddingBottom: "15px",
textAlign: "left"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { descriptionMaxWidth } from "@responsible-ai/core-ui";
import {
IProcessedStyleSet,
IStyle,
Expand Down Expand Up @@ -41,6 +42,7 @@ export const TreatmentStyles: () => IProcessedStyleSet<ITreatmentStyles> =
header: {
fontSize: 14,
margin: "20px",
maxWidth: descriptionMaxWidth,
textAlign: "left"
},
label: {
Expand Down
1 change: 1 addition & 0 deletions libs/core-ui/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export * from "./lib/util/rowErrorSize";
export * from "./lib/util/getBoxData";
export * from "./lib/util/getBasicFilterString";
export * from "./lib/util/getCausalDisplayFeatureName";
export * from "./lib/util/getCommonStyles";
export * from "./lib/util/getCompositeFilterString";
export * from "./lib/util/getErrorBarChartOptions";
export * from "./lib/util/getFeatureOptions";
Expand Down
4 changes: 4 additions & 0 deletions libs/core-ui/src/lib/util/getCommonStyles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

export const descriptionMaxWidth = "750px";
5 changes: 4 additions & 1 deletion libs/counterfactuals/src/lib/CounterfactualsTab.styles.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { descriptionMaxWidth } from "@responsible-ai/core-ui";
import {
IStyle,
mergeStyleSets,
Expand All @@ -10,6 +11,7 @@ import {

export interface ICounterfactualsTabStyles {
container: IStyle;
infoWithText: IStyle;
}

export const counterfactualsTabStyles: () => IProcessedStyleSet<ICounterfactualsTabStyles> =
Expand All @@ -19,6 +21,7 @@ export const counterfactualsTabStyles: () => IProcessedStyleSet<ICounterfactuals
container: {
color: theme.semanticColors.bodyText,
padding: "0 40px 10px 40px"
}
},
infoWithText: { maxWidth: descriptionMaxWidth }
});
};
2 changes: 1 addition & 1 deletion libs/counterfactuals/src/lib/CounterfactualsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class CounterfactualsTab extends React.PureComponent<
const classNames = counterfactualsTabStyles();
return (
<Stack grow tokens={{ padding: "l1" }} className={classNames.container}>
<Stack.Item>
<Stack.Item className={classNames.infoWithText}>
<Text variant={"medium"}>
{localization.Counterfactuals.whatifDescription}
</Text>
Expand Down
3 changes: 2 additions & 1 deletion libs/dataset-explorer/src/lib/DatasetExplorerTab.styles.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { FabricStyles } from "@responsible-ai/core-ui";
import { descriptionMaxWidth, FabricStyles } from "@responsible-ai/core-ui";
import {
IStyle,
mergeStyleSets,
Expand Down Expand Up @@ -110,6 +110,7 @@ export const datasetExplorerTabStyles: () => IProcessedStyleSet<IDatasetExplorer
width: "23px"
},
infoWithText: {
maxWidth: descriptionMaxWidth,
paddingLeft: "33px",
width: "100%"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { descriptionMaxWidth } from "@responsible-ai/core-ui";
import { Property } from "csstype";
import {
IStyle,
Expand All @@ -16,6 +17,7 @@ export interface ITreeViewRendererStyles {
clickedNodeDashed: IStyle;
clickedNodeFull: IStyle;
filledNodeText: IStyle;
infoWithText: IStyle;
legend: IStyle;
linkLabel: IStyle;
node: IStyle;
Expand Down Expand Up @@ -56,6 +58,7 @@ export const treeViewRendererStyles = (props?: {
fill: ColorPalette.ErrorAnalysisLightText
}
]),
infoWithText: { maxWidth: descriptionMaxWidth },
legend: {
pointerEvents: "none"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export class TreeViewRenderer extends React.PureComponent<
const svgHeight = maxY - minY;
return (
<Stack tokens={{ childrenGap: "l1", padding: "l1" }}>
<Stack.Item>
<Stack.Item className={classNames.infoWithText}>
<Text variant="medium">
{this.props.getTreeNodes
? localization.ErrorAnalysis.TreeView.treeDescription
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { descriptionMaxWidth } from "@responsible-ai/core-ui";
import {
IStyle,
mergeStyleSets,
Expand Down Expand Up @@ -69,6 +70,7 @@ export const globalTabStyles: () => IProcessedStyleSet<IGlobalTabStyles> =
width: "23px"
},
infoWithText: {
maxWidth: descriptionMaxWidth,
paddingLeft: "25px",
width: "100%"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { descriptionMaxWidth } from "@responsible-ai/core-ui";
import {
IStyle,
mergeStyleSets,
Expand All @@ -21,6 +22,7 @@ export const modelPerformanceTabStyles: () => IProcessedStyleSet<IModelPerforman
boxSizing: "border-box",
display: "flex",
flexDirection: "row",
maxWidth: descriptionMaxWidth,
paddingLeft: "25px",
width: "100%"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { FabricStyles } from "@responsible-ai/core-ui";
import { descriptionMaxWidth, FabricStyles } from "@responsible-ai/core-ui";
import {
IProcessedStyleSet,
getTheme,
Expand Down Expand Up @@ -235,6 +235,7 @@ export const whatIfTabStyles: () => IProcessedStyleSet<IWhatIfTabStyles> =
boxSizing: "border-box",
display: "flex",
flexDirection: "row",
maxWidth: descriptionMaxWidth,
paddingLeft: "25px",
width: "100%"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { descriptionMaxWidth } from "@responsible-ai/core-ui";
import {
IStyle,
mergeStyleSets,
Expand All @@ -13,6 +14,7 @@ export interface IFeatureImportanceStyles {
header: IStyle;
headerCount: IStyle;
headerTitle: IStyle;
infoWithText: IStyle;
selectionCounter: IStyle;
}

Expand Down Expand Up @@ -45,6 +47,7 @@ export const individualFeatureImportanceViewStyles: () => IProcessedStyleSet<IFe
paddingTop: 4
}
],
infoWithText: { maxWidth: descriptionMaxWidth },
selectionCounter: {
paddingTop: 12
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export class IndividualFeatureImportanceView extends React.Component<

return (
<Stack tokens={{ padding: "l1" }}>
<Stack.Item>
<Stack.Item className={classNames.infoWithText}>
<Text variant="medium">
{localization.ModelAssessment.FeatureImportances.IndividualFeature}
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
OverallMetricChart,
BinaryClassificationMetrics,
RegressionMetrics,
classificationTask
classificationTask,
descriptionMaxWidth
} from "@responsible-ai/core-ui";
import { localization } from "@responsible-ai/localization";
import {
Expand Down Expand Up @@ -120,7 +121,7 @@ export class ModelOverview extends React.Component<

return (
<Stack tokens={{ childrenGap: "10px", padding: "16px 40px 10px 40px" }}>
<Text variant="medium">
<Text variant="medium" style={{ maxWidth: descriptionMaxWidth }}>
{localization.Interpret.ModelPerformance.helperText}
</Text>
{!this.props.showNewModelOverviewExperience && <OverallMetricChart />}
Expand Down

0 comments on commit aa18d00

Please sign in to comment.