-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
utils: add dropdown options generator
* closes inveniosoftware/invenio-app-rdm#2593
- Loading branch information
1 parent
cb1ba08
commit 022b619
Showing
2 changed files
with
26 additions
and
0 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,25 @@ | ||
// This file is part of React-Invenio-Forms | ||
// Copyright (C) 2024 CERN. | ||
// | ||
// React-Invenio-Forms is free software; you can redistribute it and/or modify it | ||
// under the terms of the MIT License; see LICENSE file for more details. | ||
|
||
import React from "react"; | ||
|
||
export function dropdownOptionsGenerator(dropdownOptions) { | ||
return dropdownOptions.map((options) => { | ||
return { | ||
key: options.key, | ||
text: options.text, | ||
value: options.key, | ||
content: ( | ||
<> | ||
<div>{options.text}</div> | ||
<div> | ||
<small className="text-muted">{options.description}</small> | ||
</div> | ||
</> | ||
), | ||
}; | ||
}); | ||
} |
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 +1,2 @@ | ||
export { humanReadableBytes } from "./humanReadableBytes"; | ||
export { dropdownOptionsGenerator } from "./dropdownOptionsGenerator"; |