File tree Expand file tree Collapse file tree 4 files changed +41
-21
lines changed
packages/app/src/app/pages/Sandbox/Editor/Workspace/Project Expand file tree Collapse file tree 4 files changed +41
-21
lines changed Original file line number Diff line number Diff line change 1+ import { Link as LinkBase } from 'react-router-dom' ;
2+ import styled , { css } from 'styled-components' ;
3+
4+ export const Link = styled ( LinkBase ) `
5+ ${ ( { theme } ) => css `
6+ color : ${ theme . templateColor } !important ;
7+ ` }
8+ ` ;
Original file line number Diff line number Diff line change 1+ import { getSandboxName } from '@codesandbox/common/lib/utils/get-sandbox-name' ;
2+ import { sandboxUrl } from '@codesandbox/common/lib/utils/url-generator' ;
3+ import React , { FunctionComponent } from 'react' ;
4+
5+ import { useOvermind } from 'app/overmind' ;
6+
7+ import { Item , PropertyName , PropertyValue } from '../elements' ;
8+
9+ import { Link } from './elements' ;
10+
11+ export const ForkedFrom : FunctionComponent = ( ) => {
12+ const {
13+ state : {
14+ editor : {
15+ currentSandbox : { forkedFromSandbox } ,
16+ } ,
17+ } ,
18+ } = useOvermind ( ) ;
19+
20+ return (
21+ < Item >
22+ < PropertyName > Forked From</ PropertyName >
23+
24+ < PropertyValue >
25+ < Link to = { sandboxUrl ( forkedFromSandbox ) } >
26+ { getSandboxName ( forkedFromSandbox ) }
27+ </ Link >
28+ </ PropertyValue >
29+ </ Item >
30+ ) ;
31+ } ;
Original file line number Diff line number Diff line change 11import Question from 'react-icons/lib/go/question' ;
22import EditPenIcon from 'react-icons/lib/md/create' ;
3- import { Link } from 'react-router-dom' ;
43import styled , { css } from 'styled-components' ;
54
65export const Container = styled . div `
@@ -82,12 +81,6 @@ export const Icon = styled(Question)`
8281 cursor: pointer;
8382` ;
8483
85- export const TemplateStyledLink = styled ( Link ) `
86- ${ ( { theme } ) => css `
87- color: ${ theme . templateColor } !important;
88- ` }
89- ` ;
90-
9184export const BundlerLink = styled . a . attrs ( {
9285 target : '_blank' ,
9386 rel : 'noreferrer noopener' ,
Original file line number Diff line number Diff line change 11import Tooltip from '@codesandbox/common/lib/components/Tooltip' ;
22import getTemplateDefinition from '@codesandbox/common/lib/templates' ;
3- import { getSandboxName } from '@codesandbox/common/lib/utils/get-sandbox-name' ;
4- import { sandboxUrl } from '@codesandbox/common/lib/utils/url-generator' ;
53import React , { FunctionComponent } from 'react' ;
64
75import { useOvermind } from 'app/overmind' ;
@@ -20,8 +18,8 @@ import {
2018 PropertyName ,
2119 PropertyValue ,
2220 StatsContainer ,
23- TemplateStyledLink ,
2421} from './elements' ;
22+ import { ForkedFrom } from './ForkedFrom' ;
2523import { Frozen } from './Frozen' ;
2624import { Git } from './Git' ;
2725import { Keywords } from './Keywords' ;
@@ -76,17 +74,7 @@ export const Project: FunctionComponent<Props> = ({ editable = false }) => {
7674
7775 { editable && < Frozen /> }
7876
79- { forkedFromSandbox && (
80- < Item >
81- < PropertyName > Forked From</ PropertyName >
82-
83- < PropertyValue >
84- < TemplateStyledLink to = { sandboxUrl ( forkedFromSandbox ) } >
85- { getSandboxName ( forkedFromSandbox ) }
86- </ TemplateStyledLink >
87- </ PropertyValue >
88- </ Item >
89- ) }
77+ { forkedFromSandbox && < ForkedFrom /> }
9078
9179 < Item >
9280 < PropertyName >
You can’t perform that action at this time.
0 commit comments