@@ -23,12 +35,10 @@ const HyperMediaControls = ({ forms, href, actions, links }) => (
key={rel}
rel={rel}
link={links[rel][0]}
- color={'active'}
+ color={'primary'}
curies={links[rels.curies]}
/>
))}
-
-
{Object.keys(forms).map(rel => (
void;
+ setDefault: (
+ key: string,
+ model: { [key: string]: any },
+ form: Form,
+ value: string,
+ ) => void;
+ value: string;
+}
diff --git a/src/components/Hyperlink.js b/src/components/Hyperlink.tsx
similarity index 54%
rename from src/components/Hyperlink.js
rename to src/components/Hyperlink.tsx
index 5785ef3..9ace7a6 100644
--- a/src/components/Hyperlink.js
+++ b/src/components/Hyperlink.tsx
@@ -1,28 +1,43 @@
-import React from 'react';
-import { withStyles } from '@material-ui/core';
+import { WithStyles, withStyles } from '@material-ui/core';
+import React, { ReactNode, StatelessComponent } from 'react';
+import theme from '../theme';
+import { HalLink, NavigatableProps } from '../types';
import { preventDefault } from '../utils';
import { withNavigation } from './NavigationProvider';
-import theme from '../theme';
const color = theme.palette.action.active;
const styles = {
hyperlink: {
- color,
- '&:hover': {
+ '&:active': {
color,
},
- '&:active': {
+ '&:hover': {
color,
},
'&:visited': {
color,
},
+ color,
},
};
-const Hyperlink = withNavigation()(
+
+interface HyperlinkProps {
+ link: HalLink;
+}
+
+const Hyperlink: StatelessComponent<
+ HyperlinkProps & { children?: ReactNode }
+> = withNavigation()(
withStyles(styles)(
- ({ classes, link, children, authorization, onNavigate }) => (
+ ({
+ classes,
+ link,
+ children,
+ authorization,
+ onNavigate,
+ }: HyperlinkProps & { children?: ReactNode } & NavigatableProps &
+ WithStyles) => (
{
+const FeedNavigationLink: StatelessComponent<
+ FeedNavigationLinkProps
+> = withNavigation()(
+ class What extends PureComponent<
+ FeedNavigationLinkProps & NavigatableProps
+ > {
+ _handleOnClick: FormEventHandler = e => {
const { onNavigate, authorization, link } = this.props;
e.preventDefault();
@@ -21,19 +35,20 @@ const FeedNavigationLink = withNavigation()(
render() {
const { rel, link } = this.props;
return (
-
+
);
}
},
);
+interface NavigationLinksProps {
+ links: HalLinks;
+}
-const NavigationLinks = ({ links }) => (
+const NavigationLinks: StatelessComponent = ({
+ links,
+}) => (