You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tutorials/ui5-webcomponents-react-card/ui5-webcomponents-react-card.md
+25-40Lines changed: 25 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ You can check out all available components in the [Storybook](https://sap.github
37
37
38
38
2.So, youimportedthe`Card`component. Nowit's time to use it. Replace the content of your `<div>` with a `<Card>`.
39
39
40
-
Inthe [Storybook](https://sap.github.io/ui5-webcomponents-react/?path=/story/4-ui5-web-components-card--default-story), you can see that Cards can receive different props. For now only add some text as `children`.
40
+
Inthe [Storybook](https://sap.github.io/ui5-webcomponents-react/v2/?path=/docs/data-display-card--docs), you can see that Cards can receive different props. For now only add some text as `children`.
41
41
42
42
```TypeScript / TSX
43
43
<div>
@@ -85,16 +85,13 @@ The heading area of the `Card` component is empty, this is because it didn't rec
85
85
</div>
86
86
```
87
87
88
-
2.Nowthe`Card`hasaheaderarea, butthe`font-family`ofthecontentareadiffersfromthe`Card`header. AllUI5WebComponentsforReactcomponentsusethesamestyling, thisincludes`font-family`, `color`, etc.
89
-
90
-
Addthe`Text`importtoyour`MyApp.tsx`file.
88
+
3.OurtemplateappliestheSAPdefined`font-family`foralltextsthatdon't implement `font-family` themselves. (see `index.css` file)
89
+
ToenablethisonasingletextwithoutusingCSS, youcanusethe`Text`component. Let's wrap the text content of the `Card` inside the `Text` component:
91
90
92
91
```TypeScript / TSX
93
92
import { Card, CardHeader, Text } from "@ui5/webcomponents-react";
94
93
```
95
94
96
-
Andwrapthetextwithinthe`Text`component.
97
-
98
95
```TypeScript / TSX
99
96
<div>
100
97
<Card header={<CardHeader titleText="Card" />}>
@@ -103,15 +100,14 @@ The heading area of the `Card` component is empty, this is because it didn't rec
Inthisstep, wewillonlyapply [inline-styling](https://reactjs.org/docs/dom-elements.html#style). You can also style your component using CSS ([modules](https://github.com/css-modules/css-modules)) or even authoring tools like [JSS](https://cssinjs.org), but this will be covered in [Tutorial 6](ui5-webcomponents-react-styling) of the tutorial series.
YoucanalsostyleyourcomponentusingCSS ([modules](https://github.com/css-modules/css-modules)) or even authoring tools like [JSS](https://cssinjs.org), but this and many more information regarding the styling approach of UI5 Web Components (for React) will be covered in [Tutorial 6](ui5-webcomponents-react-styling) of the tutorial series.
import { spacing } from "@ui5/webcomponents-react-base";
138
-
```
139
-
140
-
Andfinallyaddthistoyour`Text`component:
141
-
142
-
```TypeScript / TSX
143
-
<Text style={spacing.sapUiContentPadding}>
122
+
2.Thecontentofthecardiswaytooclosetotheborderofthe`Card`, soa`padding`isneeded. Youcandefineyourownspacing, orusethestandardSAPspacingvariables. Inthisexamplewe're using one of the global [CSS Variables](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_cascading_variables/Using_CSS_custom_properties) from the [theming-base-content](https://github.com/SAP/theming-base-content) repo, which are already included when using UI5 Web Components.
123
+
124
+
TheCSSVarinquestionis`--sapContent_Space_S` (`1rem`) andwe're going to apply it via inline-style again:
@@ -180,9 +164,11 @@ And your application like this:
180
164
</Card>
181
165
```
182
166
183
-
Wedidn't pass a value to `interactive`, because it [defaults to true](https://reactjs.org/docs/jsx-in-depth.html#props-default-to-true) if the value is omitted.
184
-
185
-
2.Tomaketheheaderreacttoaclick, addafunction as value to the `onClick` prop.
167
+
_Wedidn't pass a value to `interactive`, because it [defaults to true](https://reactjs.org/docs/jsx-in-depth.html#props-default-to-true) if the value is omitted._
0 commit comments