MCPcopy Create free account
hub / github.com/adobe/react-spectrum / S2FAQ

Function S2FAQ

packages/dev/s2-docs/src/S2FAQ.tsx:5–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
4
5export function S2FAQ() {
6 return (
7 <div className={style({display: 'flex', flexDirection: 'column', gap: 16})}>
8 <Disclosure isQuiet>
9 <DisclosureTitle>
10 I'm getting a "Could not statically evaluate macro argument" error.
11 </DisclosureTitle>
12 <DisclosurePanel>
13 This indicates that your <code>style</code> macro has a condition that isn't evaluable at
14 build time. This can happen for a variety of reasons such as if you've referenced
15 non-constant variables within your <code>style</code> macro or if you've called non-macro
16 functions within your <code>style</code> macro. If you are using Typescript, it can be as
17 simple as forgetting to add <code>as const</code> to your own defined reusable macro.
18 </DisclosurePanel>
19 </Disclosure>
20 <Disclosure isQuiet>
21 <DisclosureTitle>
22 I'm seeing a ton of duplicate rules being generated and/or my dev tools are very slow.
23 </DisclosureTitle>
24 <DisclosurePanel>
25 Please make sure you've followed the best practices listed above.
26 </DisclosurePanel>
27 </Disclosure>
28 <Disclosure isQuiet>
29 <DisclosureTitle>
30 I tried to pass my style macro to "UNSAFE_className" but it doesn't work.
31 </DisclosureTitle>
32 <DisclosurePanel>
33 The <code>style</code> macro is not meant to be used with <code>UNSAFE_className</code>.
34 Overrides to the Spectrum styles is highly discouraged, consider styling an equivalent
35 React Aria Component instead.
36 </DisclosurePanel>
37 </Disclosure>
38 <Disclosure isQuiet>
39 <DisclosureTitle>I'm coming from S1, but where are Flex/Grid/etc?</DisclosureTitle>
40 <DisclosurePanel>
41 These no longer exist. Please style <code>&lt;div&gt;</code>, <code>&lt;span&gt;</code>,
42 and other standard HTML elements with the <code>style</code> macro instead.
43 </DisclosurePanel>
44 </Disclosure>
45 <Disclosure isQuiet>
46 <DisclosureTitle>
47 Where can I find a list of what values are supported by the style macro?
48 </DisclosureTitle>
49 <DisclosurePanel>
50 See the <Link href="style-macro">following page</Link> for a full list of what values are
51 supported by the <code>style</code> macro.
52 </DisclosurePanel>
53 </Disclosure>
54 </div>
55 );
56}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected