Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b748028

Browse files
James300jasonLaster
authored andcommitted
WIP - React Components Show React Logo (firefox-devtools#4728)
1 parent 8cf3da0 commit b748028

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

src/components/Editor/Tabs.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@
102102
background: var(--theme-highlight-blue);
103103
}
104104

105+
.source-tab img.react {
106+
mask: url(/images/react.svg) no-repeat;
107+
mask-size: 100%;
108+
padding-top: 12px;
109+
height: 14px;
110+
width: 14px;
111+
background: var(--theme-highlight-bluegrey);
112+
}
113+
105114
.source-tab .blackBox path {
106115
fill: var(--theme-textbox-box-shadow);
107116
}

src/components/Editor/Tabs.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import {
1313
getSelectedSource,
1414
getSourcesForTabs,
1515
getActiveSearch,
16-
getSearchTabs
16+
getSearchTabs,
17+
getSourceMetaData
1718
} from "../../selectors";
1819
import { isVisible } from "../../utils/ui";
1920

@@ -31,6 +32,7 @@ import Dropdown from "../shared/Dropdown";
3132
import type { List } from "immutable";
3233
import type { SourceRecord } from "../../reducers/sources";
3334
import type { ActiveSearchType } from "../../reducers/ui";
35+
import type { SourceMetaDataMap } from "../../reducers/ast";
3436
type SourcesList = List<SourceRecord>;
3537

3638
/*
@@ -95,7 +97,8 @@ type Props = {
9597
horizontal: boolean,
9698
startPanelCollapsed: boolean,
9799
endPanelCollapsed: boolean,
98-
searchOn: boolean
100+
searchOn: boolean,
101+
sourceMetaData: SourceMetaDataMap
99102
};
100103

101104
type State = {
@@ -454,7 +457,11 @@ class SourceTabs extends PureComponent<Props, State> {
454457

455458
getSourceAnnotation(source) {
456459
const sourceObj = source.toJS();
460+
const { sourceMetaData } = this.props;
457461

462+
if (sourceMetaData && sourceMetaData.isReactComponent) {
463+
return <img className="react" />;
464+
}
458465
if (isPretty(sourceObj)) {
459466
return <img className="prettyPrint" />;
460467
}
@@ -477,12 +484,16 @@ class SourceTabs extends PureComponent<Props, State> {
477484

478485
export default connect(
479486
state => {
487+
const selectedSource = getSelectedSource(state);
488+
const sourceId = selectedSource ? selectedSource.get("id") : "";
489+
480490
return {
481-
selectedSource: getSelectedSource(state),
491+
selectedSource: selectedSource,
482492
searchTabs: getSearchTabs(state),
483493
sourceTabs: getSourcesForTabs(state),
484494
activeSearch: getActiveSearch(state),
485-
searchOn: getActiveSearch(state) === "source"
495+
searchOn: getActiveSearch(state) === "source",
496+
sourceMetaData: getSourceMetaData(state, sourceId)
486497
};
487498
},
488499
dispatch => bindActionCreators(actions, dispatch)

0 commit comments

Comments
 (0)