-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #681 from danskernesdigitalebibliotek/DDFLSBP-659-…
…add-visual-indicators-on-required-fields DDFLSBP-659 - Add visual indicators on required fields
- Loading branch information
Showing
3 changed files
with
18 additions
and
2 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
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
export type InputLabelProps = { | ||
text: string; | ||
required?: boolean; | ||
}; | ||
|
||
export const InputLabel: React.FC<InputLabelProps> = ({ text }) => { | ||
return <label className="input-label">{text}</label>; | ||
export const InputLabel: React.FC<InputLabelProps> = ({ text, required }) => { | ||
const labelClass = `input-label ${required ? "input-label--required" : ""}`; | ||
return <label className={labelClass}>{text}</label>; | ||
}; |
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 |
---|---|---|
|
@@ -5,3 +5,7 @@ | |
margin-bottom: $s-sm; | ||
padding-top: $s-xs; | ||
} | ||
|
||
.input-label--required::after { | ||
content: " *"; | ||
} |