Skip to content

Commit 856785c

Browse files
author
Fabio Benedetti
committed
document Options
update example, fix package.json main
1 parent f211598 commit 856785c

File tree

4 files changed

+32
-29
lines changed

4 files changed

+32
-29
lines changed

example/src/app/App.tsx

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,23 @@
11
import * as React from 'react';
22
import styled from 'styled-components';
3-
import { Component1 } from './Comp';
3+
import { Component1 } from './Component1';
44

55
const BodyStyle = styled.div`
6-
height: 60px;
76
background: blue;
8-
width: 100%;
9-
display: flex;
10-
position: absolute;
11-
padding: 0 1rem;
12-
13-
@media (max-width: 1140px) {
14-
padding-right: 0px;
15-
}
7+
padding: 20px;
168
`;
179

1810
const Header = styled.h2`
1911
color: yellow;
2012
`;
2113

22-
class App extends React.Component<{}, {isMounted: boolean}> {
23-
state = {
24-
isMounted: false
25-
}
26-
componentDidMount(){
27-
this.setState({isMounted: true})
28-
}
14+
class App extends React.Component<{}> {
15+
2916
render(){
3017
return (
3118
<div>
3219
<BodyStyle>
3320
<Header>Welcome to Typescript Styled Components SSR</Header>
34-
{
35-
this.state.isMounted &&
36-
<div>Test Mounted</div>
37-
}
3821
<Component1 />
3922
</BodyStyle>
4023
</div>

example/src/app/Comp.tsx renamed to example/src/app/Component1.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ import * as React from 'react';
22
import styled from 'styled-components';
33

44
const Component1Style = styled.div`
5-
height: 40px;
6-
background: green;
7-
width: 200;
8-
display: flex;
5+
background: #fff;
6+
text-align: center;
97
`;
108

9+
const TextStyle = styled.h3`
10+
color: #000;
11+
font-weight: bold;
12+
`;
1113
export const Component1 : React.SFC = () => (
1214
<Component1Style>
13-
Test
15+
<TextStyle>SubComponent</TextStyle>
1416
</Component1Style>
1517
)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "typescript-plugin-styled-components",
33
"version": "0.0.6",
44
"description": "TypeScript transformer for improving the debugging experience of styled-components",
5-
"main": "distor/index.js",
5+
"main": "dist/index.js",
66
"homepage": "https://github.com/Igorbek/typescript-plugin-styled-components",
77
"repository": {
88
"url": "https://github.com/Igorbek/typescript-plugin-styled-components.git",

src/models/Options.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,28 @@ export interface Options {
55
* Default strategy is to use bindingName if it's defined and use inference algorithm from filename otherwise.
66
*/
77
getDisplayName(filename: string, bindingName: string | undefined): string | undefined;
8-
8+
9+
/**
10+
* This array allow to identify the node name in case of style-components wrapper functions
11+
*/
912
styledIdentifiers: string[];
10-
13+
14+
/**
15+
* If set to true generates a unique componentId composed by the file path and the component name (default bindingName)
16+
* default value: false
17+
*/
1118
ssr: boolean;
19+
20+
/**
21+
* If set to true sets the component dispaly name
22+
* default value: true
23+
*/
1224
displayName: boolean;
25+
26+
27+
/**
28+
* String to determine what is the project root
29+
* default value: package.json
30+
*/
1331
rootCheck: string;
1432
}

0 commit comments

Comments
 (0)