Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 5786732

Browse files
authored
Updated "Publish to NPM" Github Action to deploy storybook (#175)
* set new releases as a draft in npm-publish.yml
1 parent 8d931ab commit 5786732

File tree

6 files changed

+31
-38
lines changed

6 files changed

+31
-38
lines changed

.github/workflows/deploy-storybook.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ on:
44
# Pull request hook without any config. Launches for every pull request
55
pull_request:
66
# Launches build when release is published
7-
push:
8-
tags:
9-
- 'v*'
7+
release:
8+
types: [published]
109

1110
env:
1211
REPO_NAME_ALPHANUMERIC: safereactcomponents

.github/workflows/npm-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
uses: actions/create-release@v1
6161
id: create_release
6262
with:
63-
draft: false
63+
draft: true
6464
prerelease: false
6565
release_name: ${{ steps.version.outputs.version }}
6666
tag_name: ${{ steps.version.outputs.version }}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gnosis.pm/safe-react-components",
3-
"version": "0.9.1",
3+
"version": "0.9.2",
44
"description": "Gnosis UI components",
55
"main": "dist/index.min.js",
66
"typings": "dist/index.d.ts",

src/inputs/AddressInput/AddressInput.stories.tsx

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ export const SimpleAddressInput = ({
7070
showErrors: boolean;
7171
}): React.ReactElement => {
7272
const [address, setAddress] = useState<string>('');
73-
const onChangeAddress = useCallback((address) => setAddress(address), []);
7473

7574
const [currentNetworkPrefix, setCurrentNetworkPrefix] = useState('rin');
7675

@@ -85,13 +84,16 @@ export const SimpleAddressInput = ({
8584
address && showErrors ? inValidNetworkError || inValidAddressError : '';
8685

8786
// fake ENS Resolution
88-
const getAddressFromDomain = () =>
89-
new Promise<string>((resolve) => {
90-
setTimeout(
91-
() => resolve('0x83eC7B0506556a7749306D69681aDbDbd08f0769'),
92-
2000
93-
);
94-
});
87+
const getAddressFromDomain = useCallback(
88+
() =>
89+
new Promise<string>((resolve) => {
90+
setTimeout(
91+
() => resolve('0x83eC7B0506556a7749306D69681aDbDbd08f0769'),
92+
2000
93+
);
94+
}),
95+
[]
96+
);
9597

9698
return (
9799
<div>
@@ -113,7 +115,7 @@ export const SimpleAddressInput = ({
113115
name="address"
114116
placeholder={'Ethereum address'}
115117
address={address}
116-
onChangeAddress={onChangeAddress}
118+
onChangeAddress={setAddress}
117119
getAddressFromDomain={getAddressFromDomain}
118120
hiddenLabel={hiddenLabel}
119121
error={error}
@@ -161,7 +163,6 @@ export const AddressInputWithENSResolution = (): React.ReactElement => {
161163
const [address, setAddress] = useState<string>('');
162164
const [showError, setShowError] = useState<boolean>(false);
163165
const [error, setError] = useState<string>('');
164-
const onChangeAddress = useCallback((address) => setAddress(address), []);
165166

166167
const [customENSThrottleDelay, setCustomENSThrottleDelay] = useState<
167168
number | undefined
@@ -213,7 +214,7 @@ export const AddressInputWithENSResolution = (): React.ReactElement => {
213214
address={address}
214215
helperText={'Type safe.test to check ENS resolution!'}
215216
disabled={!customENSThrottleDelay}
216-
onChangeAddress={onChangeAddress}
217+
onChangeAddress={setAddress}
217218
getAddressFromDomain={getAddressFromDomain}
218219
customENSThrottleDelay={customENSThrottleDelay}
219220
/>
@@ -251,7 +252,6 @@ export const AddressInputWithENSResolution = (): React.ReactElement => {
251252

252253
export const SafeAddressInputValidation = (): React.ReactElement => {
253254
const [address, setAddress] = useState<string>('');
254-
const onChangeAddress = useCallback((address) => setAddress(address), []);
255255
const [isValidSafeAddress, setIsValidSafeAddress] = useState<boolean>(false);
256256
const [showLoadingSpinner, setShowLoadingSpinner] = useState<boolean>(false);
257257

@@ -296,7 +296,7 @@ export const SafeAddressInputValidation = (): React.ReactElement => {
296296
showNetworkPrefix={false}
297297
error={showError ? error : ''}
298298
address={address}
299-
onChangeAddress={onChangeAddress}
299+
onChangeAddress={setAddress}
300300
showLoadingSpinner={showLoadingSpinner}
301301
InputProps={{
302302
endAdornment: isValidSafeAddress && (
@@ -315,8 +315,7 @@ export const SafeAddressInputValidation = (): React.ReactElement => {
315315

316316
export const AddressInputWithSimpleAddressValidation =
317317
(): React.ReactElement => {
318-
const [address, setAddress] = useState<string>('');
319-
const onChangeAddress = useCallback((address) => setAddress(address), []);
318+
const [address, setAddress] = useState<string>('0x123...');
320319
const [hasError, setHasError] = useState<boolean>();
321320

322321
useEffect(() => {
@@ -334,7 +333,7 @@ export const AddressInputWithSimpleAddressValidation =
334333
networkPrefix="rin"
335334
error={hasError ? error : ''}
336335
address={address}
337-
onChangeAddress={onChangeAddress}
336+
onChangeAddress={setAddress}
338337
/>
339338
{/* Address In the State */}
340339
<StyledText>Address In the State:</StyledText>
@@ -347,7 +346,6 @@ export const AddressInputWithoutPrefix = (): React.ReactElement => {
347346
const [address, setAddress] = useState<string>(
348347
'0x83eC7B0506556a7749306D69681aDbDbd08f0769'
349348
);
350-
const onChangeAddress = useCallback((address) => setAddress(address), []);
351349

352350
return (
353351
<form noValidate autoComplete="off" onSubmit={onSubmit}>
@@ -356,7 +354,7 @@ export const AddressInputWithoutPrefix = (): React.ReactElement => {
356354
name="address"
357355
placeholder={'Ethereum address'}
358356
address={address}
359-
onChangeAddress={onChangeAddress}
357+
onChangeAddress={setAddress}
360358
/>
361359
{/* Address In the State */}
362360
<StyledText>Address In the State:</StyledText>
@@ -369,19 +367,18 @@ export const AddressInputLoading = (): React.ReactElement => {
369367
const [address, setAddress] = useState<string>(
370368
'0x83eC7B0506556a7749306D69681aDbDbd08f0769'
371369
);
372-
const onChangeAddress = useCallback((address) => setAddress(address), []);
373370

374371
return (
375372
<form noValidate autoComplete="off" onSubmit={onSubmit}>
376373
<AddressInput
377374
label="Address"
378375
name="address"
379376
networkPrefix="rin"
380-
showNetworkPrefix={false}
377+
showNetworkPrefix
381378
placeholder={'Ethereum address'}
382379
showLoadingSpinner
383380
address={address}
384-
onChangeAddress={onChangeAddress}
381+
onChangeAddress={setAddress}
385382
/>
386383
</form>
387384
);
@@ -391,15 +388,14 @@ export const AddressInputWithAdornment = (): React.ReactElement => {
391388
const [address, setAddress] = useState<string>(
392389
'0x83eC7B0506556a7749306D69681aDbDbd08f0769'
393390
);
394-
const onChangeAddress = useCallback((address) => setAddress(address), []);
395391

396392
return (
397393
<form noValidate autoComplete="off" onSubmit={onSubmit}>
398394
<AddressInput
399395
label="Address"
400396
name="address"
401397
networkPrefix="rin"
402-
showNetworkPrefix={false}
398+
showNetworkPrefix
403399
showLoadingSpinner={false}
404400
placeholder={'Ethereum address'}
405401
InputProps={{
@@ -410,7 +406,7 @@ export const AddressInputWithAdornment = (): React.ReactElement => {
410406
),
411407
}}
412408
address={address}
413-
onChangeAddress={onChangeAddress}
409+
onChangeAddress={setAddress}
414410
/>
415411
</form>
416412
);
@@ -420,20 +416,19 @@ export const AddressInputDisabled = (): React.ReactElement => {
420416
const [address, setAddress] = useState<string>(
421417
'0x83eC7B0506556a7749306D69681aDbDbd08f0769'
422418
);
423-
const onChangeAddress = useCallback((address) => setAddress(address), []);
424419

425420
return (
426421
<form noValidate autoComplete="off" onSubmit={onSubmit}>
427422
<AddressInput
428423
label="Address"
429424
name="address"
430425
networkPrefix="rin"
431-
showNetworkPrefix={false}
426+
showNetworkPrefix
432427
showLoadingSpinner={false}
433428
disabled
434429
placeholder={'Ethereum address'}
435430
address={address}
436-
onChangeAddress={onChangeAddress}
431+
onChangeAddress={setAddress}
437432
/>
438433
</form>
439434
);
@@ -443,7 +438,6 @@ export const AddressInputWithErrors = (): React.ReactElement => {
443438
const [address, setAddress] = useState<string>(
444439
'0x83eC7B0506556a7749306D69681aDbDbd08f0769'
445440
);
446-
const onChangeAddress = useCallback((address) => setAddress(address), []);
447441

448442
return (
449443
<form noValidate autoComplete="off" onSubmit={onSubmit}>
@@ -455,7 +449,7 @@ export const AddressInputWithErrors = (): React.ReactElement => {
455449
placeholder={'Ethereum address'}
456450
showLoadingSpinner={false}
457451
address={address}
458-
onChangeAddress={onChangeAddress}
452+
onChangeAddress={setAddress}
459453
error={'Invalid Address'}
460454
/>
461455
</form>

src/inputs/AddressInput/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function AddressInput({
4747
showLoadingSpinner,
4848
InputProps,
4949
inputProps,
50-
hiddenLabel = true,
50+
hiddenLabel = false,
5151
...rest
5252
}: AddressInputProps): ReactElement {
5353
const [isLoadingENSResolution, setIsLoadingENSResolution] = useState(false);

tests/inputs/AddressInput/__snapshots__/AddressInput.stories.storyshot

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ exports[`Storyshots Inputs/AddressInput Address Input With Simple Address Valida
387387
onSubmit={[Function]}
388388
>
389389
<div
390-
className="MuiFormControl-root MuiTextField-root sc-jJoQJp gNEEiH"
390+
className="MuiFormControl-root MuiTextField-root sc-jJoQJp bqJZEI"
391391
spellCheck={false}
392392
>
393393
<label
@@ -405,7 +405,7 @@ exports[`Storyshots Inputs/AddressInput Address Input With Simple Address Valida
405405
<input
406406
aria-invalid={false}
407407
autoFocus={false}
408-
className="MuiInputBase-input MuiFilledInput-input MuiInputBase-inputHiddenLabel MuiFilledInput-inputHiddenLabel"
408+
className="MuiInputBase-input MuiFilledInput-input"
409409
disabled={false}
410410
id="address"
411411
name="address"
@@ -427,7 +427,7 @@ exports[`Storyshots Inputs/AddressInput Address Input With Simple Address Valida
427427
<pre
428428
className="sc-jUosCB eSSjao"
429429
>
430-
430+
0x123...
431431
</pre>
432432
</form>
433433
`;

0 commit comments

Comments
 (0)