-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: replace HTMLSelect with TgHTMLSelect to provide better disabled…
… experience
- Loading branch information
Showing
6 changed files
with
62 additions
and
54 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { HTMLSelect } from "@blueprintjs/core"; | ||
import React from "react"; | ||
import classNames from "classnames"; | ||
|
||
// so far this component just makes the styling of the disabled html select | ||
// look like a regular html select with the selected option displayed | ||
// (instead of greyed out and without the ability to have tooltips working) | ||
const TgHTMLSelect = ({ disabled, ...rest }) => { | ||
if (disabled) { | ||
const opt = rest.options.find(o => o.value === rest.value); | ||
return ( | ||
<div {...rest} className={classNames("bp3-html-select", rest.className)}> | ||
{opt.label} | ||
</div> | ||
); | ||
} | ||
return <HTMLSelect {...rest}></HTMLSelect>; | ||
}; | ||
|
||
export default TgHTMLSelect; |
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