Skip to content

Commit 1135e7c

Browse files
taraokellyshockey
authored andcommitted
Swagger ui redesign/custom dropdown (via #5381)
* improvement: OAS3 $ref friendly-name regex in model.jsx (via #5334) * improvement: relax schema description styling so Markdown can be effective (via #5340) * improvement: add `isShown` check to <ModelCollapse />'s prop `expanded` logic (via #5331) * Add and apply default button classes, styling * Update buttons to use custom component * Fix breaking unit tests * Replace button transition, replace EOF new-line * Apply custom sui-btn-wrapper class * Add span wrapper for button-text (allows us to apply em padding / margins on button element) * security: CVE-2018-20834 (via #5368) * bump minimum `bundlesize` version * bump `node-sass` * bump webpack + webpack-dev-server; update lockfile * release: v3.22.2 * Abstract default classnames to Button component * Use classnames lib where applicable * Fix unit tests * Tidy up, remove unused classnames * eliminate `auth` class * eliminate `authorize` class * move `.sui-btn--authorize` to buttons stylesheet * Remove duplicate import after merge * Dropdown component set up * Dropdown id & custom class props * Dropdown disabled prop * Basic DropDownItem, Updated Dropdown child classnames to not inherit modifer * Layout-utils restucture * Dropdown Basic controls * Dropdown Labels * Moved Dropdown to LayoutUtils * Dropdowm relocation cleanup * Dropdowm relocation cleanup P2 * Dropdown refs rough draft * Dropdown movement controls * Dropdown select option functionality * Dropdown default selected value and default placeholder * Add temporary dropdown icon - to be replaced by fontawesome * Move clickhandler to li element * Wrap dropdown text in span * Update alter-hue mixin to accept custom degree * Update dropdown styling * Apply custom Dropdown to "schemes" * Dropdown onChange * Removed Dropdown labels * Dropdown classname improvements * IE/Edge specific keyboard event keys * Removed onKeyPress * Dropdown classname improvements * Dropdown move item focus function * Dropdown move item focus function update * Replaced xclass with classnames * Dropdown styling * Dropdown seperate children function * Dropdown icon * Dropdown error handling - no children * Dropdown no options available msg
1 parent def81fe commit 1135e7c

18 files changed

+730
-282
lines changed

src/core/components/layout-utils.jsx

Lines changed: 0 additions & 272 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import React from "react"
2+
import PropTypes from "prop-types"
3+
import cx from "classnames"
4+
5+
export default class Button extends React.Component {
6+
7+
static propTypes = {
8+
className: PropTypes.string,
9+
unstyled: PropTypes.bool,
10+
mod: PropTypes.string
11+
}
12+
13+
static defaultProps = {
14+
className: "",
15+
unstyled: false,
16+
mod: "primary"
17+
}
18+
19+
defaultClasses = ({ unstyled, mod }) => !unstyled ? `sui-btn sui-btn--${mod}` : ""
20+
21+
render() {
22+
const { unstyled, mod, className, ...props } = this.props
23+
24+
return (
25+
<button
26+
{...props}
27+
className={cx(className, this.defaultClasses({ unstyled, mod }))}
28+
/>
29+
)
30+
}
31+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import React from "react"
2+
import PropTypes from "prop-types"
3+
import cx from "classnames"
4+
5+
const DEVICES = {
6+
"mobile": "",
7+
"tablet": "-tablet",
8+
"desktop": "-desktop",
9+
"large": "-hd"
10+
}
11+
12+
export default class Col extends React.Component {
13+
14+
render() {
15+
const {
16+
hide,
17+
keepContents,
18+
/* we don't want these in the `rest` object that passes to the final component,
19+
since React now complains. So we extract them */
20+
/* eslint-disable no-unused-vars */
21+
mobile,
22+
tablet,
23+
desktop,
24+
large,
25+
/* eslint-enable no-unused-vars */
26+
...rest
27+
} = this.props
28+
29+
if(hide && !keepContents)
30+
return <span/>
31+
32+
let classesAr = []
33+
34+
for (let device in DEVICES) {
35+
if (!DEVICES.hasOwnProperty(device)) {
36+
continue
37+
}
38+
let deviceClass = DEVICES[device]
39+
if(device in this.props) {
40+
let val = this.props[device]
41+
42+
if(val < 1) {
43+
classesAr.push("none" + deviceClass)
44+
continue
45+
}
46+
47+
classesAr.push("block" + deviceClass)
48+
classesAr.push("col-" + val + deviceClass)
49+
}
50+
}
51+
52+
let classes = cx(rest.className, classesAr.join(" "))
53+
54+
return (
55+
<section {...rest} style={{display: hide ? "none": null}} className={classes}/>
56+
)
57+
}
58+
59+
}
60+
61+
Col.propTypes = {
62+
hide: PropTypes.bool,
63+
keepContents: PropTypes.bool,
64+
mobile: PropTypes.number,
65+
tablet: PropTypes.number,
66+
desktop: PropTypes.number,
67+
large: PropTypes.number,
68+
className: PropTypes.string
69+
}

0 commit comments

Comments
 (0)