Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Change Safe App name TextField from readonly to disabled #3366

Merged
merged 2 commits into from
Jan 25, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/routes/safe/components/Apps/components/AddAppForm/index.tsx
@@ -1,9 +1,8 @@
import { Icon, Link, Loader, Text, TextField } from '@gnosis.pm/safe-react-components'
import { theme, Icon, Link, Loader, Text, TextField } from '@gnosis.pm/safe-react-components'
import { useState, ReactElement, useCallback, useEffect } from 'react'
import { useHistory } from 'react-router-dom'
import styled from 'styled-components'
import { SafeApp } from 'src/routes/safe/components/Apps/types'

import GnoForm from 'src/components/forms/GnoForm'
import Img from 'src/components/layout/Img'
import { Modal } from 'src/components/Modal'
Expand All @@ -19,6 +18,22 @@ const FORM_ID = 'add-apps-form'
const StyledTextFileAppName = styled(TextField)`
&& {
width: 385px;
.MuiFormLabel-root {
&.Mui-disabled {
color: rgba(0, 0, 0, 0.54);
&.Mui-error {
color: ${theme.colors.error};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the theme passed via props like here https://styled-components.com/docs/advanced#theming?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!! Updated it

}
}
}
.MuiInputBase-root {
.MuiFilledInput-input {
color: rgba(0, 0, 0, 0.54);
}
&:before {
border-bottom-style: inset;
}
}
}
`

Expand Down Expand Up @@ -141,7 +156,7 @@ const AddApp = ({ appList, closeModal, onAddApp }: AddAppProps): ReactElement =>
)}
<StyledTextFileAppName
label="App name"
readOnly
disabled
meta={{ error: fetchError }}
value={isLoading ? 'Loading...' : appInfo.name === DEFAULT_APP_INFO.name ? '' : appInfo.name}
onChange={() => {}}
Expand Down