ui: CSS modules for BarCharts components#47484
ui: CSS modules for BarCharts components#47484craig[bot] merged 5 commits intocockroachdb:masterfrom
Conversation
|
❌ The GitHub CI (Cockroach) build has failed on eecf8b55. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
eecf8b5 to
29120ca
Compare
|
❌ The GitHub CI (Cockroach) build has failed on 29120cab. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
nathanstilwell
left a comment
There was a problem hiding this comment.
I approve of this approach!
29120ca to
92aefcf
Compare
|
❌ The GitHub CI (Cockroach) build has failed on 92aefcf5. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
92aefcf to
e953ca7
Compare
dhartunian
left a comment
There was a problem hiding this comment.
Very exciting @koorosh!! Just a few notes on the visuals in the storybook.
Reviewed 5 of 8 files at r1, 2 of 8 files at r6, 1 of 1 files at r7, 5 of 5 files at r8.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @koorosh and @nathanstilwell)
pkg/ui/src/views/statements/barCharts.stories.tsx, line 18 at r8 (raw file):
const { statements } = statementsPagePropsFixture; storiesOf("BarCharts", module)
All the charts stop getting more narrow as I squish the browser window horizontally. Is there something preventing them from getting very small in the storybook? They have to get quite small to fit into the table columns.
pkg/ui/src/views/statements/barCharts.stories.tsx, line 27 at r8 (raw file):
return chartFactory(statements[0]); }) .add("retryBarChart", () => {
The retry bar chart should render in red. Also it shows a negative number in my storybook. Can we render with positive?
pkg/ui/src/views/statements/statementsPage.fixture.ts, line 23 at r8 (raw file):
"count": Long.fromNumber(3), "first_attempt_count": Long.fromNumber(100000), "max_retries": Long.fromNumber(10),
dhartunian
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @koorosh and @nathanstilwell)
pkg/ui/src/views/statements/barCharts.tsx, line 141 at r8 (raw file):
}; const className = classNames(styles["bar-chart"], styles[`bar-chart-${type}`], {
The ${type} is what makes the bar chart red for retries so not sure what's missing...
7697ae7 to
3077c47
Compare
|
@dhartunian, thanks for your suggestions, indeed there some gaps with BarCharts which have to be fixed.
Storybook had default Also to show bar charts within table columns - additional stories are added. Check out
Fixed. The problem was with the wrong indentation for nested styles. |
3077c47 to
5a3d00c
Compare
5a4d023 to
3ab378b
Compare
dhartunian
left a comment
There was a problem hiding this comment.
This all looks good from code perspective but causes a regression on the app right now. Could you take a look?
Reviewed 1 of 7 files at r9, 1 of 1 files at r10, 6 of 7 files at r11, 4 of 4 files at r12.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @koorosh and @nathanstilwell)
Regression with column width occurred because .statements-table__col-rows, .statements-table__col-latency // <-- defined as global CSS
.bar-chart // <-- trying to access class which is defined in CSS module
min-width 150pxFor me, it's a dilemma how to keep PR small enough with changes related directly to Refactoring |
To test styles isolation for statements page we need storybook which displays entire Statements screen only. To make it work, RouterProvider decorator is added which connects router to dummy (empty) store. `statementsPage.fixture.ts` file contains snapshot of required props for StatementsPage component Release note: None
Before all css files were loaded into global scope even if file was imported in some particular module. Now it is possible to define styles as before and use old styles without changes, and as a module, to do this - files has to be named as someName.module.styl In webpack config, `style-loader` is defined two times with different file name matchers to be able define style loaders with and without modules. Release note: None
- added storybook with barCharts to show all possible types of barCharts - Also typescript doesn't recognize `module.styl` files as modules by default, so custom module declaration is added Release note: None
Previously, class names were constructed by simply accessing style modules class names and assigning it to classes. It was cumbersome and not readable at all. To enhance this, `classnames/bind` alternate is used, which allows simply put class names. Release note: None
Previously, Statements table altered styles of barCharts by overriding them. It was necessary to set fixed width for barCharts which were displayed in Statements table columns. When `barCharts` were refactored to use CSS modules it became impossible to override styles in such way (and it isn't react way). Now, it is possible to extend `barCharts` styles by providing additional `options` param with `classess` field. It consumes `root` and `label` clasess, and then applies them inside of component. Note, `statementsTable.module.styl` file has more styles than is used right now, because this entire file was ported here from another PR and this allows easily rebase it later. Release note: None
3ab378b to
038b52f
Compare
|
@dhartunian , I managed to port changes related to custom styles for |
dhartunian
left a comment
There was a problem hiding this comment.
Wonderful. Looks good to me. Let's ship it!
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @dhartunian, @koorosh, and @nathanstilwell)
|
bors r+ |
Build failed |
|
bors r+ |
Build succeeded |
47513: ui: CSS modules for PlanView component r=koorosh a=koorosh Depends on: #47484 Related to: #47527 - Refactored font imports to correctly resolve paths when module is required from different locations; Fonts are imported directly from `app.styl` file which allows import `typography.styl` without dependencies. This change was required because importing `typography.styl` file from CSS modules failed with unresolved paths inside of `fonts.styl` file (which was required in `typography.styl` file). Before, ``` app.styl |-- typography.styl |-- fonts.styl ``` Now: ``` app.styl |-- typography.styl |-- fonts.styl ``` - Move all files related to PlanView component under `planView` directory - Added storybook for `PlanView` component - `planView.module.styl` file contains copy of styles (from `statements.styl`) which is used by component only. Release note: None 49779: opt: incorporate cast volatility r=RaduBerinde a=RaduBerinde This change incorporates the new cast volatility information into the VolatilitySet property. Release note: None 49783: geo/geotransform: implement ST_Transform r=sumeerbhola a=otan This PR implements ST_Transform, allowing the transformation from one SRID to another. The `geoprojbase` package defines a barebones set of types as well as a hardcoded list of SRIDs to keep in memory. I've only filled in a few for now, and will save updating this for a later PR. `geoproj` is strictly a C library interface library which performs the necessary transformations. `geotransform` is where the function is actually handled and to be used by `geo_builtins.go`. Resolves #49055 Resolves #49056 Resolves #49057 Resolves #49058 Release note (sql change): Implemented the ST_Transform function for geometries. 49804: opt: ON UPDATE cascades for Upsert r=RaduBerinde a=RaduBerinde This change implements ON UPDATE actions for Upsert operations. The existing machinery for Update can be used without modification. Release note: None Co-authored-by: Andrii Vorobiov <and.vorobiov@gmail.com> Co-authored-by: Radu Berinde <radu@cockroachlabs.com> Co-authored-by: Oliver Tan <otan@cockroachlabs.com>



Depends on: #47417
Depends on: cockroachdb/yarn-vendored#20
Related to: #47527
Current draft is just example for possible styles isolation with CSS modules.
It is required to make components self-contained and easy for extraction.
Before all css files were loaded into
global scope even if file was imported in
some particular module.
Now it is possible to define styles as before
and use old styles without changes, and as a
module, to do this - files has to be named as
someName.module.styl
In webpack config,
style-loaderis definedtwo times with different file name matchers
to be able define style loaders with and without
modules.
barChartscomponent is a first candidate to try out css modules.barChartsare copied(!) tobarCharts.module.stylfile,so in case another component somehow relies on styles defined for barCharts
Storybook is extended with stories related to
barCharts