Skip to content

Commit ed755c6

Browse files
authored
Merge pull request #751 from materialsproject/styling_components
add custom CSS and prop-based theming for data entry components
2 parents 13d7e13 + 3fa8e7e commit ed755c6

4 files changed

Lines changed: 32 additions & 7 deletions

File tree

.github/workflows/publish-npm.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
name: publish-npm
22
on:
3-
workflow_dispatch:
4-
push:
5-
tags:
6-
- 'v*'
3+
release:
4+
types: [published]
5+
76
jobs:
87
publish:
98
runs-on: ubuntu-latest
@@ -29,6 +28,9 @@ jobs:
2928
- name: Build project
3029
run: |
3130
npm run build-publish
31+
- name: Sync version from Git Tag
32+
run: |
33+
npm version ${{ github.ref_name }} --no-git-tag-version
3234
- name: Publish to NPM
3335
run: |
3436
echo Publishing to test repo $NODE_AUTH_TOKEN

src/components/data-entry/DualRangeSlider/DualRangeSlider.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ export interface DualRangeSliderProps {
7575
* This can be used to lift the new "nice" domain upwards.
7676
*/
7777
onPropsChange?: (props: any) => void;
78+
/**
79+
* styles for input
80+
*/
81+
styleInput?: object;
82+
/**
83+
* styles for slider
84+
*/
85+
styleSlider?: object;
7886
}
7987

8088
/**
@@ -343,6 +351,7 @@ export const DualRangeSlider: React.FC<DualRangeSliderProps> = ({
343351
<input
344352
data-testid="lower-bound-input"
345353
className="input is-small"
354+
style={props.styleInput}
346355
type="number"
347356
value={lowerBound}
348357
min={scale.domain()[0]}
@@ -355,6 +364,7 @@ export const DualRangeSlider: React.FC<DualRangeSliderProps> = ({
355364
<input
356365
data-testid="upper-bound-input"
357366
className="input is-small"
367+
style={props.styleInput}
358368
type="number"
359369
value={upperBound}
360370
min={scale.domain()[0]}
@@ -364,7 +374,7 @@ export const DualRangeSlider: React.FC<DualRangeSliderProps> = ({
364374
/>
365375
</div>
366376
</div>
367-
<div className="slider">
377+
<div className="slider" style={props.styleSlider}>
368378
<Range
369379
values={values}
370380
step={step}

src/components/data-entry/FilterField/FilterField.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ interface FilterFieldProps {
3030
*/
3131
active?: boolean;
3232
resetFilter?: (id: any) => any;
33+
/**
34+
* styles for label
35+
*/
36+
styleLabel?: object;
3337
}
3438

3539
/**
@@ -74,7 +78,7 @@ export const FilterField: React.FC<FilterFieldProps> = ({ dois = [], ...otherPro
7478
return (
7579
<div id={props.id} className={classNames('mpc-filter-field', props.className)}>
7680
{props.label && (
77-
<div className="mpc-filter-label">
81+
<div className="mpc-filter-label" style={props.styleLabel}>
7882
{renderFilterLabel()}
7983
{props.dois.map((doi, i) => (
8084
<PublicationButton key={`${i}-${doi}`} doi={doi} compact className="tag ml-2" />

src/components/data-entry/RangeSlider/RangeSlider.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,14 @@ export interface RangeSliderProps {
158158
* Function to call when slider values change.
159159
*/
160160
onChange?: (values: number[]) => void;
161+
/**
162+
* styles for input
163+
*/
164+
styleInput?: object;
165+
/**
166+
* styles for slider
167+
*/
168+
styleSlider?: object;
161169
}
162170

163171
/**
@@ -258,14 +266,15 @@ export const RangeSlider: React.FC<RangeSliderProps> = ({
258266
<input
259267
data-testid="lower-bound-input"
260268
className="input is-small"
269+
style={props.styleInput}
261270
type="number"
262271
value={inputValue}
263272
min={scale.domain()[0]}
264273
max={scale.domain()[1]}
265274
step={props.step}
266275
onChange={handleInputChange}
267276
/>
268-
<div className="slider">
277+
<div className="slider" style={props.styleSlider}>
269278
<Range
270279
values={values}
271280
step={props.step}

0 commit comments

Comments
 (0)