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

Commit f4fe956

Browse files
committed
fix(Site): Remove tabler-react source code button from SiteHeader
Adds a new navItems prop to SiteHeader to pass through any nav items to display Fixes #174
1 parent d5b68c8 commit f4fe956

2 files changed

Lines changed: 19 additions & 22 deletions

File tree

example/src/SiteWrapper.react.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import * as React from "react";
44
import { NavLink } from "react-router-dom";
55

6-
import { Site } from "tabler-react";
6+
import { Site, Nav, Button } from "tabler-react";
77

88
type Props = {|
99
+children: React.Node,
@@ -140,6 +140,20 @@ class SiteWrapper extends React.Component<Props, void> {
140140
href: "/",
141141
alt: "Tabler React",
142142
imageURL: "./demo/brand/tabler.svg",
143+
navItems: (
144+
<Nav.Item type="div" className="d-none d-md-flex">
145+
<Button
146+
href="https://github.com/tabler/tabler-react"
147+
target="_blank"
148+
outline
149+
size="sm"
150+
RootComponent="a"
151+
color="primary"
152+
>
153+
Source code
154+
</Button>
155+
</Nav.Item>
156+
),
143157
notificationsTray: { notificationsObjects },
144158
accountDropdown: accountDropdownProps,
145159
}}

src/components/Site/SiteHeader.react.js

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
// @flow
22

33
import * as React from "react";
4-
import {
5-
Container,
6-
Site,
7-
Nav,
8-
Button,
9-
Notification,
10-
AccountDropdown,
11-
} from "../";
4+
import { Container, Site, Notification, AccountDropdown } from "../";
125
import type { Props as NotificationTrayProps } from "../Notification/NotificationTray.react";
136
import type { Props as AccountDropdownProps } from "../AccountDropdown/AccountDropdown.react";
147

@@ -31,6 +24,7 @@ export type Props = {|
3124
*/
3225
+notificationsTray?: NotificationTrayProps,
3326
+accountDropdown?: AccountDropdownProps,
27+
+navItems?: React.Node,
3428
|};
3529

3630
/**
@@ -44,6 +38,7 @@ const SiteHeader = ({
4438
alt,
4539
notificationsTray: notificationsTrayFromProps,
4640
accountDropdown: accountDropdownFromProps,
41+
navItems,
4742
}: Props): React.Node => {
4843
const notificationsTray =
4944
notificationsTrayFromProps &&
@@ -61,19 +56,7 @@ const SiteHeader = ({
6156
<React.Fragment>
6257
<Site.Logo href={href} alt={alt} src={imageURL} />
6358
<div className="d-flex order-lg-2 ml-auto">
64-
<Nav.Item type="div" className="d-none d-md-flex">
65-
<Button
66-
href="https://github.com/tabler/tabler-react"
67-
target="_blank"
68-
outline
69-
size="sm"
70-
RootComponent="a"
71-
color="primary"
72-
>
73-
Source code
74-
</Button>
75-
</Nav.Item>
76-
59+
{navItems}
7760
{notificationsTray}
7861
{accountDropdown}
7962
</div>

0 commit comments

Comments
 (0)