Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit 6c45fec

Browse files
converted main export of HyperMediaControls
1 parent 59a2118 commit 6c45fec

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

src/components/HyperMediaControls/LinkButton.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
import { TextField } from '@material-ui/core';
1+
import { PropTypes, TextField } from '@material-ui/core';
22
import React, { PureComponent, StatelessComponent } from 'react';
33
import uriTemplate from 'uri-template';
44
import { HalLink, NavigatableProps } from '../../types';
55
import { preventDefault } from '../../utils';
66
import { withNavigation } from '../NavigationProvider';
77
import Dialog from './Dialog';
88
import RelButton from './RelButton';
9+
import Color = PropTypes.Color;
910

1011
interface LinkButtonProps {
1112
readonly rel: string;
1213
readonly link: HalLink;
14+
color: Color;
1315
}
1416

1517
interface TemplatedLinkButtonProps extends LinkButtonProps {

src/components/HyperMediaControls/index.js renamed to src/components/HyperMediaControls/index.tsx

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,29 @@
1-
import React from 'react';
21
import { Card, CardActions } from '@material-ui/core';
2+
import React, { StatelessComponent } from 'react';
33
import { connect, createState } from '../../reactive';
4-
import { navigation, store } from '../../stream-store';
5-
import LinkButton from './LinkButton';
4+
import { navigation, rels, store } from '../../stream-store';
5+
import { HalLinks } from '../../types';
66
import FormButton from './FormButton';
7-
import { rels } from '../../stream-store';
7+
import LinkButton from './LinkButton';
88

9-
const isNotSelf = (rel, links) =>
9+
const isNotSelf = (rel: string, links: HalLinks): boolean =>
1010
links[rels.self] && links[rel][0].href !== links[rels.self][0].href;
1111

1212
const state$ = createState(store.url$.map(href => ['href', () => href]));
1313

14-
const HyperMediaControls = ({ forms, href, actions, links }) => (
14+
interface HyperMediaControlsProps {
15+
actions: any;
16+
href: string;
17+
links: HalLinks;
18+
forms: { [rel: string]: any };
19+
}
20+
21+
const HyperMediaControls: StatelessComponent<HyperMediaControlsProps> = ({
22+
forms,
23+
href,
24+
actions,
25+
links,
26+
}) => (
1527
<Card>
1628
<CardActions>
1729
<div>
@@ -23,7 +35,7 @@ const HyperMediaControls = ({ forms, href, actions, links }) => (
2335
key={rel}
2436
rel={rel}
2537
link={links[rel][0]}
26-
color={'active'}
38+
color={'primary'}
2739
curies={links[rels.curies]}
2840
/>
2941
))}

0 commit comments

Comments
 (0)