Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add modern colors for datetime and table packages #4931

Merged
merged 7 commits into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/datetime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"react-dom": "^15.3.0 || 16 || 17"
},
"devDependencies": {
"@blueprintjs/colors": "^5.0.0-alpha.0",
"@blueprintjs/karma-build-scripts": "^2.0.2",
"@blueprintjs/node-build-scripts": "^1.6.0",
"@blueprintjs/test-commons": "^0.10.13",
Expand Down
62 changes: 62 additions & 0 deletions packages/datetime/src/blueprint-datetime-modern.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
@import "~@blueprintjs/colors/lib/scss/colors";

$datepicker-day-background-color-hover: rgba($gray3, 0.15);
$datepicker-day-background-color-active: rgba($gray3, 0.3);
$dark-datepicker-day-background-color-hover: rgba($gray3, 0.15);
$dark-datepicker-day-background-color-active: rgba($gray3, 0.3);
$daterangepicker-range-background-color: rgba($blue3, 0.1);
$daterangepicker-range-background-color-selected: rgba($blue3, 0.1);
$daterangepicker-range-background-color-selected-hover: rgba($blue3, 0.2);
$dark-daterangepicker-range-background-color: rgba($blue3, 0.2);
$dark-daterangepicker-range-background-color-selected: rgba($blue3, 0.2);
$dark-daterangepicker-range-background-color-selected-hover: rgba($blue3, 0.4);

@import "./blueprint-datetime";

/* stylelint-disable selector-class-pattern */

.#{$ns}-datepicker, .#{$ns}-daterangepicker {
.DayPicker-Day {
&.DayPicker-Day--selected {
&:active {
background-color: $blue1;
}

.#{$ns}-dark & {
&:hover {
background-color: $blue2;
}

&:active {
background-color: $blue1;
}
}
}
}
}

.#{$ns}-daterangepicker {
.DayPicker-Day {
&--hovered-range {
color: $blue2;
}

&--selected-range {
color: $blue2;

&:hover {
color: $blue2;
}
}

.#{$ns}-dark & {
&--hovered-range {
color: $light-gray5;
}

&--selected-range {
color: $light-gray5;
}
}
}
}
30 changes: 30 additions & 0 deletions packages/demo-app/src/examples/DatePickerExample.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* Copyright 2020 Palantir Technologies, Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.*/

import * as React from "react";

import { Classes } from "@blueprintjs/core";
import { DatePicker } from "@blueprintjs/datetime";

import { ExampleCard } from "./ExampleCard";

const WIDTH = 300;
export const DatePickerExample = React.memo(() => {
adidahiya marked this conversation as resolved.
Show resolved Hide resolved
return (
<ExampleCard width={WIDTH} horizontal={true} label="Date picker">
<DatePicker className={Classes.ELEVATION_1} />
</ExampleCard>
);
});
adidahiya marked this conversation as resolved.
Show resolved Hide resolved
DatePickerExample.displayName = "DatePickerExample";
29 changes: 29 additions & 0 deletions packages/demo-app/src/examples/DateRangePickerExample.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* Copyright 2020 Palantir Technologies, Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.*/

import * as React from "react";

import { Classes } from "@blueprintjs/core";
import { DateRangePicker } from "@blueprintjs/datetime";

import { ExampleCard } from "./ExampleCard";

export const DateRangePickerExample = React.memo(() => {
return (
<ExampleCard width={700} horizontal={true} label="Date range picker">
<DateRangePicker className={Classes.ELEVATION_1} />
</ExampleCard>
);
});
DateRangePickerExample.displayName = "DateRangerPickerExample";
8 changes: 6 additions & 2 deletions packages/demo-app/src/examples/Examples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import { BreadcrumbExample } from "./BreadcrumbExample";
import { ButtonExample } from "./ButtonExample";
import { CalloutExample } from "./CalloutExample";
import { CheckboxRadioExample } from "./CheckboxRadioExample";
import { DatePickerExample } from "./DatePickerExample";
import { DateRangePickerExample } from "./DateRangePickerExample";
import { DialogExample } from "./DialogExample";
import { EditableTextExample } from "./EditableTextExample";
import { HtmlCodeExample } from "./HtmlCodeExample";
Expand All @@ -30,6 +32,7 @@ import { InputExample } from "./InputExample";
import { MenuExample } from "./MenuExample";
import { SliderExample } from "./SliderExample";
import { SwitchExample } from "./SwitchExample";
import { TableExample } from "./TableExample";
import { TabsExample } from "./TabsExample";
import { TagExample } from "./TagExample";
import { TextExample } from "./TextExample";
Expand All @@ -45,7 +48,8 @@ export class Examples extends React.PureComponent {
<ButtonExample />
<CalloutExample />
<CheckboxRadioExample />
{/* Add DatePickerExample */}
<DatePickerExample />
<DateRangePickerExample />
<DialogExample className={className} />
<EditableTextExample />
<HtmlCodeExample />
Expand All @@ -55,7 +59,7 @@ export class Examples extends React.PureComponent {
<MenuExample />
<SliderExample />
<SwitchExample />
{/* Add TableExample */}
<TableExample />
<TabsExample />
<TagExample />
<TextExample />
Expand Down
53 changes: 53 additions & 0 deletions packages/demo-app/src/examples/TableExample.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/* Copyright 2020 Palantir Technologies, Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.*/

import * as React from "react";

import { Cell, Column, ColumnHeaderCell, Table2 } from "@blueprintjs/table";

import { ExampleCard } from "./ExampleCard";

const WIDTH = 600;
export const TableExample = React.memo(() => {
const cellRenderer = React.useCallback(
(rowIndex: number, columnIndex: number) => <Cell>{`${rowIndex}, ${columnIndex}`}</Cell>,
[],
);
const columnHeaderCellRenderer = React.useCallback(
(index: number) => <ColumnHeaderCell name={`Column ${index}`} />,
[],
);
return (
<ExampleCard width={WIDTH} horizontal={true} label="Table">
<Table2 numRows={4}>
<Column
cellRenderer={cellRenderer}
columnHeaderCellRenderer={columnHeaderCellRenderer}
key="column-1"
/>
<Column
cellRenderer={cellRenderer}
columnHeaderCellRenderer={columnHeaderCellRenderer}
key="column-2"
/>
<Column
cellRenderer={cellRenderer}
columnHeaderCellRenderer={columnHeaderCellRenderer}
key="column-2"
/>
</Table2>
</ExampleCard>
);
});
TableExample.displayName = "TableExample";
2 changes: 2 additions & 0 deletions packages/demo-app/src/index.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@import "~@blueprintjs/core/lib/css/blueprint-modern.css";
@import "~@blueprintjs/datetime/lib/css/blueprint-datetime-modern.css";
@import "~@blueprintjs/table/lib/css/table-modern.css";
@import "~@blueprintjs/popover2/lib/css/blueprint-popover2.css";

@import "./styles/examples";
Expand Down
1 change: 1 addition & 0 deletions packages/table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"react-dom": "^15.3.0 || 16 || 17"
},
"devDependencies": {
"@blueprintjs/colors": "^5.0.0-alpha.0",
"@blueprintjs/node-build-scripts": "^1.6.0",
"@blueprintjs/test-commons": "^0.10.13",
"enzyme": "^3.11.0",
Expand Down
7 changes: 7 additions & 0 deletions packages/table/src/table-modern.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@import "~@blueprintjs/colors/lib/scss/colors";
@import "./table";

.#{$ns}-dark & .#{$ns}-table-selection-region {
background-color: rgba($blue4, 0.1);
border: $cell-border-width solid $blue4;
}