mirror of
https://github.com/wassname/talk.git
synced 2026-07-16 11:22:16 +08:00
[CORL-260] Bring back sorting (#2186)
* feat: sort stream * feat: add FieldSet component to ui * feat: make accessible and add feature test * test: fix snapshots
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
.root {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
name: AriaInfo
|
||||
menu: UI Kit
|
||||
---
|
||||
|
||||
import { Playground, PropsTable } from "docz";
|
||||
|
||||
# FieldSet
|
||||
|
||||
Simple `fieldset` with removed styling for accessibility purposes.
|
||||
@@ -0,0 +1,14 @@
|
||||
import React from "react";
|
||||
import TestRenderer from "react-test-renderer";
|
||||
|
||||
import { PropTypesOf } from "talk-framework/types";
|
||||
|
||||
import FieldSet from "./FieldSet";
|
||||
|
||||
it("renders correctly", () => {
|
||||
const props: PropTypesOf<typeof FieldSet> = {
|
||||
children: "content",
|
||||
};
|
||||
const renderer = TestRenderer.create(<FieldSet {...props} />);
|
||||
expect(renderer.toJSON()).toMatchSnapshot();
|
||||
});
|
||||
@@ -0,0 +1,26 @@
|
||||
import cn from "classnames";
|
||||
import React, { AllHTMLAttributes, Ref, StatelessComponent } from "react";
|
||||
|
||||
import { withForwardRef, withStyles } from "talk-ui/hocs";
|
||||
import { PropTypesOf } from "talk-ui/types";
|
||||
|
||||
import styles from "./FieldSet.css";
|
||||
|
||||
interface InnerProps extends AllHTMLAttributes<HTMLElement> {
|
||||
/**
|
||||
* This prop can be used to add custom classnames.
|
||||
* It is handled by the `withStyles `HOC.
|
||||
*/
|
||||
classes: typeof styles;
|
||||
/** Internal: Forwarded Ref */
|
||||
forwardRef?: Ref<HTMLFieldSetElement>;
|
||||
}
|
||||
|
||||
const FieldSet: StatelessComponent<InnerProps> = props => {
|
||||
const { className, classes, forwardRef: ref, ...rest } = props;
|
||||
const rootClassName = cn(classes.root, className);
|
||||
return <fieldset className={rootClassName} {...rest} ref={ref} />;
|
||||
};
|
||||
const enhanced = withForwardRef(withStyles(styles)(FieldSet));
|
||||
export type FieldSetProps = PropTypesOf<typeof enhanced>;
|
||||
export default enhanced;
|
||||
@@ -0,0 +1,9 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`renders correctly 1`] = `
|
||||
<fieldset
|
||||
className="FieldSet-root"
|
||||
>
|
||||
content
|
||||
</fieldset>
|
||||
`;
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from "./FieldSet";
|
||||
Reference in New Issue
Block a user