MCPcopy
hub / github.com/styletron/styletron / styled

Function styled

packages/styletron-react/src/index.tsx:185–214  ·  view source on GitHub ↗
(base: any, styleArg)

Source from the content-addressed store, hash-verified

183 wrapper,
184}: createStyledOpts): StyledFn {
185 function styled(base: any, styleArg) {
186 if (__DEV__) {
187 if (base.__STYLETRON__) {
188 /* eslint-disable no-console */
189 console.warn(
190 "It appears you are passing a styled component into `styled`.",
191 );
192 console.warn(
193 "For composition with existing styled components, use `withStyle` or `withTransform` instead.",
194 );
195 /* eslint-enable no-console */
196 }
197 }
198
199 const baseStyletron: Styletron = {
200 reducers: [],
201 base: base,
202 driver,
203 getInitialStyle,
204 wrapper,
205 };
206
207 if (__BROWSER__ && __DEV__) {
208 addDebugMetadata(baseStyletron, 2);
209 }
210
211 return createStyledElementComponent(
212 autoComposeShallow(baseStyletron, styleArg),
213 );
214 }
215
216 return styled;
217}

Calls 3

addDebugMetadataFunction · 0.90
autoComposeShallowFunction · 0.85

Tested by

no test coverage detected