Skip to content

Commit 1d77a10

Browse files
committed
docs: updated exampes and as prop function
1 parent 9968e52 commit 1d77a10

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

example/index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ <h1>Basic Example</h1>
150150
secondary: 'papayawhip',
151151
tertiary: 'lavenderblush'
152152
}">
153-
<!--
154153
<wrapper>
155154
<custom-title :visible="true" :animate="animated1"> {{text1}} </custom-title>
156155
<styled-input v-model="text1" />
@@ -161,7 +160,6 @@ <h1>Basic Example</h1>
161160
<styled-input v-model="text2" />
162161
<super-btn visible @click="animated2 = !animated2"> An extension of Styled Button </super-btn>
163162
</w-2>
164-
-->
165163
<w-3
166164
bg="#c6f7e6"
167165
>

src/models/StyledComponent.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default (ComponentStyle) => {
1919
}
2020
},
2121
props: {
22-
as: undefined,
22+
as: [String, Object],
2323
value: null,
2424
...currentProps,
2525
...prevProps
@@ -40,18 +40,7 @@ export default (ComponentStyle) => {
4040
}
4141

4242
return createElement(
43-
/**
44-
* The reason for this check is to test whether the "target" is a Vue / Styled component.
45-
* If the target is a styled component, we render that styled component to preserve the
46-
* styles inherited from the "target" in the new component to be rendered.
47-
*
48-
* The "target" will inherently possess the "as" polymorphic prop. This allows the
49-
* consumer component to render the tag passed inside of it's "as" element it's
50-
* rendering recursively.
51-
*
52-
* Otherwise if the "target" is not a styled component we render the "as" prop element.
53-
* If the "as" prop is not provided, we use the default element.
54-
*/
43+
// Check if target is StyledComponent to preserve inner component styles for composition
5544
isVueComponent(target) ? target : this.$props.as || target,
5645
{
5746
class: [this.generatedClassName],

0 commit comments

Comments
 (0)