-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change: Extract ErrorMarker from useFormValidation hook module
Hooks should not contain JSX code and should be plain JS only. Therefore extract the ErrorMarker component from the useFormValidation module and use `js` file suffix for the module.
- Loading branch information
1 parent
564309d
commit 01a0cbd
Showing
6 changed files
with
38 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* SPDX-FileCopyrightText: 2024 Greenbone AG | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import styled from 'styled-components'; | ||
|
||
import {styledExcludeProps} from 'web/utils/styledConfig'; | ||
import Theme from 'web/utils/theme'; | ||
|
||
const StyledMarker = styledExcludeProps(styled.div, ['isVisible'])` | ||
color: ${Theme.darkRed}; | ||
color: ${props => props.color}; | ||
font-weight: bold; | ||
font-size: 19px; | ||
padding-bottom: 1px; | ||
padding-left: 4px; | ||
display: ${props => (props.isVisible ? 'inline' : 'none')}; | ||
`; | ||
|
||
const ErrorMarker = props => ( | ||
<StyledMarker {...props} data-testid="error-marker"> | ||
× | ||
</StyledMarker> | ||
); | ||
|
||
export default ErrorMarker; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters