-
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from styled-components/new-api
Switch to new API withConfig, fixes #16
- Loading branch information
Showing
8 changed files
with
59 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,21 @@ | ||
const Test = styled({ | ||
target: 'div', | ||
const Test = styled.div.withConfig({ | ||
displayName: 'Test' | ||
})`width: 100%;`; | ||
const Test2 = styled({ | ||
target: 'div', | ||
const Test2 = styled('div').withConfig({ | ||
displayName: 'Test2' | ||
})``; | ||
const Test3 = true ? styled({ | ||
target: 'div', | ||
const Test3 = true ? styled.div.withConfig({ | ||
displayName: 'Test3' | ||
})`` : styled({ | ||
target: 'div', | ||
})`` : styled.div.withConfig({ | ||
displayName: 'Test3' | ||
})``; | ||
const styles = { One: styled({ | ||
target: 'div', | ||
const styles = { One: styled.div.withConfig({ | ||
displayName: 'One' | ||
})`` }; | ||
let Component; | ||
Component = styled({ | ||
target: 'div', | ||
Component = styled.div.withConfig({ | ||
displayName: 'Component' | ||
})``; | ||
const WrappedComponent = styled({ | ||
target: Inner, | ||
const WrappedComponent = styled(Inner).withConfig({ | ||
displayName: 'WrappedComponent' | ||
})``; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,18 @@ | ||
const Test = styled({ | ||
target: "div", | ||
identifier: "Test-137hlza" | ||
const Test = styled.div.withConfig({ | ||
componentId: "Test-137hlza" | ||
})`width: 100%;`; | ||
const Test2 = true ? styled({ | ||
target: "div", | ||
identifier: "Test2-bjbly" | ||
})`` : styled({ | ||
target: "div", | ||
identifier: "Test2-3rtkrg" | ||
const Test2 = true ? styled.div.withConfig({ | ||
componentId: "Test2-bjbly" | ||
})`` : styled.div.withConfig({ | ||
componentId: "Test2-3rtkrg" | ||
})``; | ||
const styles = { One: styled({ | ||
target: "div", | ||
identifier: "One-1sf086v" | ||
const styles = { One: styled.div.withConfig({ | ||
componentId: "One-1sf086v" | ||
})`` }; | ||
let Component; | ||
Component = styled({ | ||
target: "div", | ||
identifier: "Component-1uo0y5n" | ||
Component = styled.div.withConfig({ | ||
componentId: "Component-1uo0y5n" | ||
})``; | ||
const WrappedComponent = styled({ | ||
target: Inner, | ||
identifier: "WrappedComponent-1hk71jk" | ||
const WrappedComponent = styled(Inner).withConfig({ | ||
componentId: "WrappedComponent-1hk71jk" | ||
})``; |
30 changes: 12 additions & 18 deletions
30
test/fixtures/03-add-identifier-and-display-name/after.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,24 @@ | ||
const Test = styled({ | ||
target: "div", | ||
const Test = styled.div.withConfig({ | ||
displayName: "Test", | ||
identifier: "Test-18z24ew" | ||
componentId: "Test-18z24ew" | ||
})`width: 100%;`; | ||
const Test2 = true ? styled({ | ||
target: "div", | ||
const Test2 = true ? styled.div.withConfig({ | ||
displayName: "Test2", | ||
identifier: "Test2-1hn2b5r" | ||
})`` : styled({ | ||
target: "div", | ||
componentId: "Test2-1hn2b5r" | ||
})`` : styled.div.withConfig({ | ||
displayName: "Test2", | ||
identifier: "Test2-1hl3gfs" | ||
componentId: "Test2-1hl3gfs" | ||
})``; | ||
const styles = { One: styled({ | ||
target: "div", | ||
const styles = { One: styled.div.withConfig({ | ||
displayName: "One", | ||
identifier: "One-1r8uh7y" | ||
componentId: "One-1r8uh7y" | ||
})`` }; | ||
let Component; | ||
Component = styled({ | ||
target: "div", | ||
Component = styled.div.withConfig({ | ||
displayName: "Component", | ||
identifier: "Component-1e47qp" | ||
componentId: "Component-1e47qp" | ||
})``; | ||
const WrappedComponent = styled({ | ||
target: Inner, | ||
const WrappedComponent = styled(Inner).withConfig({ | ||
displayName: "WrappedComponent", | ||
identifier: "WrappedComponent-kam0ab" | ||
componentId: "WrappedComponent-kam0ab" | ||
})``; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,26 @@ | ||
import s from "styled-components"; | ||
|
||
const Test = s({ | ||
target: "div", | ||
const Test = s.div.withConfig({ | ||
displayName: "Test", | ||
identifier: "Test-62sgar" | ||
componentId: "Test-62sgar" | ||
})`width: 100%;`; | ||
const Test2 = true ? s({ | ||
target: "div", | ||
const Test2 = true ? s.div.withConfig({ | ||
displayName: "Test2", | ||
identifier: "Test2-1rmo90j" | ||
})`` : s({ | ||
target: "div", | ||
componentId: "Test2-1rmo90j" | ||
})`` : s.div.withConfig({ | ||
displayName: "Test2", | ||
identifier: "Test2-1e44ey5" | ||
componentId: "Test2-1e44ey5" | ||
})``; | ||
const styles = { One: s({ | ||
target: "div", | ||
const styles = { One: s.div.withConfig({ | ||
displayName: "One", | ||
identifier: "One-amesrd" | ||
componentId: "One-amesrd" | ||
})`` }; | ||
let Component; | ||
Component = s({ | ||
target: "div", | ||
Component = s.div.withConfig({ | ||
displayName: "Component", | ||
identifier: "Component-ohabty" | ||
componentId: "Component-ohabty" | ||
})``; | ||
const WrappedComponent = s({ | ||
target: Inner, | ||
const WrappedComponent = s(Inner).withConfig({ | ||
displayName: "WrappedComponent", | ||
identifier: "WrappedComponent-1f8r9pi" | ||
componentId: "WrappedComponent-1f8r9pi" | ||
})``; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
import styled from "styled-components"; | ||
|
||
const Test = styled({ | ||
target: "div", | ||
const Test = styled.div.withConfig({ | ||
displayName: "before__Test", | ||
identifier: "before__Test-102oti6" | ||
componentId: "before__Test-102oti6" | ||
})`color: red;`; | ||
styled({ | ||
target: "div", | ||
styled.div.withConfig({ | ||
displayName: "before", | ||
identifier: "before-hxqpa7" | ||
componentId: "before-hxqpa7" | ||
})``; | ||
export default styled({ | ||
target: "button", | ||
export default styled.button.withConfig({ | ||
displayName: "before", | ||
identifier: "before-17r4qjq" | ||
componentId: "before-17r4qjq" | ||
})``; |
5 changes: 2 additions & 3 deletions
5
test/fixtures/06-work-with-hoisted-default-as-import/after.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
const Test = s({ | ||
target: 'div', | ||
const Test = s.div.withConfig({ | ||
displayName: 'before__Test', | ||
identifier: 'before__Test-1ex1ta1' | ||
componentId: 'before__Test-1ex1ta1' | ||
})`width: 100%;`; | ||
import { default as s, css } from 'styled-components'; |