aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/pages/documentation/source_link.tsx
blob: 2fb69e2f077fbddaa6797bd7bb33a954bba96bd2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import * as React from 'react';
import {colors} from 'material-ui/styles';
import {Source} from 'ts/types';
import {constants} from 'ts/utils/constants';

interface SourceLinkProps {
    source: Source;
    version: string;
}

export function SourceLink(props: SourceLinkProps) {
    const source = props.source;
    const githubUrl = constants.GITHUB_0X_JS_URL;
    const sourceCodeUrl = `${githubUrl}/blob/v${props.version}/${source.fileName}#L${source.line}`;
    return (
        <div className="pt2" style={{fontSize: 14}}>
            <a
                href={sourceCodeUrl}
                target="_blank"
                className="underline"
                style={{color: colors.grey500}}
            >
                Source
            </a>
        </div>
    );
}