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

Commit

Permalink
Updated "Publish to NPM" Github Action to deploy storybook (#175)
Browse files Browse the repository at this point in the history
* set new releases as a draft in npm-publish.yml
  • Loading branch information
DaniSomoza authored Dec 3, 2021
1 parent 8d931ab commit 5786732
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 38 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/deploy-storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ on:
# Pull request hook without any config. Launches for every pull request
pull_request:
# Launches build when release is published
push:
tags:
- 'v*'
release:
types: [published]

env:
REPO_NAME_ALPHANUMERIC: safereactcomponents
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
uses: actions/create-release@v1
id: create_release
with:
draft: false
draft: true
prerelease: false
release_name: ${{ steps.version.outputs.version }}
tag_name: ${{ steps.version.outputs.version }}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gnosis.pm/safe-react-components",
"version": "0.9.1",
"version": "0.9.2",
"description": "Gnosis UI components",
"main": "dist/index.min.js",
"typings": "dist/index.d.ts",
Expand Down
52 changes: 23 additions & 29 deletions src/inputs/AddressInput/AddressInput.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export const SimpleAddressInput = ({
showErrors: boolean;
}): React.ReactElement => {
const [address, setAddress] = useState<string>('');
const onChangeAddress = useCallback((address) => setAddress(address), []);

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

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

// fake ENS Resolution
const getAddressFromDomain = () =>
new Promise<string>((resolve) => {
setTimeout(
() => resolve('0x83eC7B0506556a7749306D69681aDbDbd08f0769'),
2000
);
});
const getAddressFromDomain = useCallback(
() =>
new Promise<string>((resolve) => {
setTimeout(
() => resolve('0x83eC7B0506556a7749306D69681aDbDbd08f0769'),
2000
);
}),
[]
);

return (
<div>
Expand All @@ -113,7 +115,7 @@ export const SimpleAddressInput = ({
name="address"
placeholder={'Ethereum address'}
address={address}
onChangeAddress={onChangeAddress}
onChangeAddress={setAddress}
getAddressFromDomain={getAddressFromDomain}
hiddenLabel={hiddenLabel}
error={error}
Expand Down Expand Up @@ -161,7 +163,6 @@ export const AddressInputWithENSResolution = (): React.ReactElement => {
const [address, setAddress] = useState<string>('');
const [showError, setShowError] = useState<boolean>(false);
const [error, setError] = useState<string>('');
const onChangeAddress = useCallback((address) => setAddress(address), []);

const [customENSThrottleDelay, setCustomENSThrottleDelay] = useState<
number | undefined
Expand Down Expand Up @@ -213,7 +214,7 @@ export const AddressInputWithENSResolution = (): React.ReactElement => {
address={address}
helperText={'Type safe.test to check ENS resolution!'}
disabled={!customENSThrottleDelay}
onChangeAddress={onChangeAddress}
onChangeAddress={setAddress}
getAddressFromDomain={getAddressFromDomain}
customENSThrottleDelay={customENSThrottleDelay}
/>
Expand Down Expand Up @@ -251,7 +252,6 @@ export const AddressInputWithENSResolution = (): React.ReactElement => {

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

Expand Down Expand Up @@ -296,7 +296,7 @@ export const SafeAddressInputValidation = (): React.ReactElement => {
showNetworkPrefix={false}
error={showError ? error : ''}
address={address}
onChangeAddress={onChangeAddress}
onChangeAddress={setAddress}
showLoadingSpinner={showLoadingSpinner}
InputProps={{
endAdornment: isValidSafeAddress && (
Expand All @@ -315,8 +315,7 @@ export const SafeAddressInputValidation = (): React.ReactElement => {

export const AddressInputWithSimpleAddressValidation =
(): React.ReactElement => {
const [address, setAddress] = useState<string>('');
const onChangeAddress = useCallback((address) => setAddress(address), []);
const [address, setAddress] = useState<string>('0x123...');
const [hasError, setHasError] = useState<boolean>();

useEffect(() => {
Expand All @@ -334,7 +333,7 @@ export const AddressInputWithSimpleAddressValidation =
networkPrefix="rin"
error={hasError ? error : ''}
address={address}
onChangeAddress={onChangeAddress}
onChangeAddress={setAddress}
/>
{/* Address In the State */}
<StyledText>Address In the State:</StyledText>
Expand All @@ -347,7 +346,6 @@ export const AddressInputWithoutPrefix = (): React.ReactElement => {
const [address, setAddress] = useState<string>(
'0x83eC7B0506556a7749306D69681aDbDbd08f0769'
);
const onChangeAddress = useCallback((address) => setAddress(address), []);

return (
<form noValidate autoComplete="off" onSubmit={onSubmit}>
Expand All @@ -356,7 +354,7 @@ export const AddressInputWithoutPrefix = (): React.ReactElement => {
name="address"
placeholder={'Ethereum address'}
address={address}
onChangeAddress={onChangeAddress}
onChangeAddress={setAddress}
/>
{/* Address In the State */}
<StyledText>Address In the State:</StyledText>
Expand All @@ -369,19 +367,18 @@ export const AddressInputLoading = (): React.ReactElement => {
const [address, setAddress] = useState<string>(
'0x83eC7B0506556a7749306D69681aDbDbd08f0769'
);
const onChangeAddress = useCallback((address) => setAddress(address), []);

return (
<form noValidate autoComplete="off" onSubmit={onSubmit}>
<AddressInput
label="Address"
name="address"
networkPrefix="rin"
showNetworkPrefix={false}
showNetworkPrefix
placeholder={'Ethereum address'}
showLoadingSpinner
address={address}
onChangeAddress={onChangeAddress}
onChangeAddress={setAddress}
/>
</form>
);
Expand All @@ -391,15 +388,14 @@ export const AddressInputWithAdornment = (): React.ReactElement => {
const [address, setAddress] = useState<string>(
'0x83eC7B0506556a7749306D69681aDbDbd08f0769'
);
const onChangeAddress = useCallback((address) => setAddress(address), []);

return (
<form noValidate autoComplete="off" onSubmit={onSubmit}>
<AddressInput
label="Address"
name="address"
networkPrefix="rin"
showNetworkPrefix={false}
showNetworkPrefix
showLoadingSpinner={false}
placeholder={'Ethereum address'}
InputProps={{
Expand All @@ -410,7 +406,7 @@ export const AddressInputWithAdornment = (): React.ReactElement => {
),
}}
address={address}
onChangeAddress={onChangeAddress}
onChangeAddress={setAddress}
/>
</form>
);
Expand All @@ -420,20 +416,19 @@ export const AddressInputDisabled = (): React.ReactElement => {
const [address, setAddress] = useState<string>(
'0x83eC7B0506556a7749306D69681aDbDbd08f0769'
);
const onChangeAddress = useCallback((address) => setAddress(address), []);

return (
<form noValidate autoComplete="off" onSubmit={onSubmit}>
<AddressInput
label="Address"
name="address"
networkPrefix="rin"
showNetworkPrefix={false}
showNetworkPrefix
showLoadingSpinner={false}
disabled
placeholder={'Ethereum address'}
address={address}
onChangeAddress={onChangeAddress}
onChangeAddress={setAddress}
/>
</form>
);
Expand All @@ -443,7 +438,6 @@ export const AddressInputWithErrors = (): React.ReactElement => {
const [address, setAddress] = useState<string>(
'0x83eC7B0506556a7749306D69681aDbDbd08f0769'
);
const onChangeAddress = useCallback((address) => setAddress(address), []);

return (
<form noValidate autoComplete="off" onSubmit={onSubmit}>
Expand All @@ -455,7 +449,7 @@ export const AddressInputWithErrors = (): React.ReactElement => {
placeholder={'Ethereum address'}
showLoadingSpinner={false}
address={address}
onChangeAddress={onChangeAddress}
onChangeAddress={setAddress}
error={'Invalid Address'}
/>
</form>
Expand Down
2 changes: 1 addition & 1 deletion src/inputs/AddressInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function AddressInput({
showLoadingSpinner,
InputProps,
inputProps,
hiddenLabel = true,
hiddenLabel = false,
...rest
}: AddressInputProps): ReactElement {
const [isLoadingENSResolution, setIsLoadingENSResolution] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ exports[`Storyshots Inputs/AddressInput Address Input With Simple Address Valida
onSubmit={[Function]}
>
<div
className="MuiFormControl-root MuiTextField-root sc-jJoQJp gNEEiH"
className="MuiFormControl-root MuiTextField-root sc-jJoQJp bqJZEI"
spellCheck={false}
>
<label
Expand All @@ -405,7 +405,7 @@ exports[`Storyshots Inputs/AddressInput Address Input With Simple Address Valida
<input
aria-invalid={false}
autoFocus={false}
className="MuiInputBase-input MuiFilledInput-input MuiInputBase-inputHiddenLabel MuiFilledInput-inputHiddenLabel"
className="MuiInputBase-input MuiFilledInput-input"
disabled={false}
id="address"
name="address"
Expand All @@ -427,7 +427,7 @@ exports[`Storyshots Inputs/AddressInput Address Input With Simple Address Valida
<pre
className="sc-jUosCB eSSjao"
>
0x123...
</pre>
</form>
`;
Expand Down

0 comments on commit 5786732

Please sign in to comment.