|
| 1 | +--- |
| 2 | +description: Card usage |
| 3 | +title: Usage |
| 4 | +weight: 100 |
| 5 | +--- |
| 6 | +## General usage |
| 7 | +The structure of a card looks like the following: |
| 8 | +```plaintext |
| 9 | +<card-layout > |
| 10 | + <card-section> |
| 11 | + <card title="SOME_TITLE">SOME CONTENT icon="SOME_LUCIDE_ICON"><\card> |
| 12 | + ... |
| 13 | + <card>SOME CONTENT<\card> |
| 14 | + </card-section> |
| 15 | +</card-layout > |
| 16 | +``` |
| 17 | + |
| 18 | +and will render as the following: |
| 19 | +<div data-testid="cards-test__basic"> |
| 20 | + {{<card-layout >}} |
| 21 | + {{<card-section>}} |
| 22 | + {{<card title="SOME_TITLE">}} |
| 23 | + SOME CONTENT |
| 24 | + {{</card >}} |
| 25 | + {{</card-section>}} |
| 26 | + {{</card-layout >}} |
| 27 | +</div> |
| 28 | + |
| 29 | +### Params |
| 30 | +To support customization, there are also some params you can add to the shortcode `<card>` such as `title`, `titleUrl`, `icon`, `brandIcon`, `isFeaturedCard`, `isFullSize`. |
| 31 | + |
| 32 | +* `title` (required) - Title of the card. |
| 33 | +<br> |
| 34 | +* `titleUrl` (optional) - URL for the card. |
| 35 | +<br> |
| 36 | +* `icon` (optional) - Custom icon using <a href="https://lucide.dev/icons/">lucide</a> icons. |
| 37 | +<br> |
| 38 | +* `brandIcon` (optional) - Custom icon using image from `nginx-hugo-theme/static/images/icons`. |
| 39 | + * Usage: `<card brandIcon="NGINX-App-Protect-WAF-product-icon"...>` |
| 40 | +<br> |
| 41 | +* `isFeaturedCard` (optional) - Boolean indicating whether or not the card should be the first one and full size. By default, false. |
| 42 | + * Usage: `<card isFeaturedCard="true"...>` |
| 43 | +<br> |
| 44 | +* `isFullSize` (optional) - Boolean indicating whether or not the card should be full size. By default, cards are half sized. |
| 45 | + * Usage: `<card isFullSize="true"...>` |
| 46 | + |
| 47 | +For the `<card-section>`, there are some params you can add such as `title`, `isFeaturedSection`, and `showAsCards`. |
| 48 | +* `title` - Title of the section. |
| 49 | +<br> |
| 50 | +* `isFeaturedSection` (optional) - Boolean indicating whether or not the section is a featured one - will discuss later down the page. By default, false. |
| 51 | +<br> |
| 52 | +* `showAsCards` (optional) - Boolean indicating whether or not the cards in the section should appear with borders. By default, false. |
| 53 | + |
| 54 | +### Additional Information |
| 55 | +While it may come immediate, you can't use a `<card>` shortcode on its own in your markdown or else the build will fail. This is because if you call a card, there is no way to structure it in a writer-friendly customizable way. |
| 56 | + |
| 57 | +## Show as cards |
| 58 | +As you can see from the above example in 'General usage', it renders as a plain box that does not resemble a card. To change the appearance and render as a card, use the param `showAsCards` in the shortcode `<card-section>`. The usage as seen below: |
| 59 | +```plaintext |
| 60 | +<card-layout > |
| 61 | + <card-section showAsCards="true"> |
| 62 | + <card title="SOME_TITLE">SOME CONTENT icon="SOME_LUCIDE_ICON"><\card> |
| 63 | + ... |
| 64 | + <card>SOME CONTENT<\card> |
| 65 | + </card-section> |
| 66 | +</card-layout > |
| 67 | +``` |
| 68 | +and will render as the following: |
| 69 | +<div data-testid="cards-test__showAsCards"> |
| 70 | + {{<card-layout >}} |
| 71 | + {{<card-section showAsCards="true">}} |
| 72 | + {{<card title="SOME_TITLE">}} |
| 73 | + SOME CONTENT |
| 74 | + {{</card >}} |
| 75 | + {{</card-section>}} |
| 76 | + {{</card-layout >}} |
| 77 | +</div> |
| 78 | + |
| 79 | +## Featured Section |
| 80 | +Denoted by the param `isFeaturedSection` in the shortcode `<card-layout>`, this block of cards can contain only up to three cards. |
| 81 | + |
| 82 | +<div data-testid="cards-test__featuredSection"> |
| 83 | + {{<card-layout >}} |
| 84 | + {{<card-section showAsCards="true" isFeaturedSection="true">}} |
| 85 | + {{<card title="Everything" titleUrl="everything" icon="circle-dot-dashed">}} |
| 86 | + All shortcodes in one page. |
| 87 | + {{</card >}} |
| 88 | + {{<card title="Call Out usages" titleUrl="call-out/all-callouts/" icon="message-square">}} |
| 89 | + Examples for call-out shortcode |
| 90 | + {{</card >}} |
| 91 | + {{<card title="Code Block usages" titleUrl="code-blocks/code-blocks-highlighting/" icon="code">}} |
| 92 | + Examples for codeblock shortcode |
| 93 | + {{</card >}} |
| 94 | + {{<card title="Code Block usages" titleUrl="code-blocks/code-blocks-highlighting/" icon="code">}} |
| 95 | + Examples for codeblock shortcode |
| 96 | + {{</card >}} |
| 97 | + {{</card-section>}} |
| 98 | + {{</card-layout >}} |
| 99 | +</div> |
| 100 | + |
| 101 | +## Featured Card |
| 102 | +Denoted by the param `isFeaturedCard` in the shortcode `<card>`, this will push the card up to very top of the section and make it full length. |
| 103 | +<div data-testid="cards-test__featuredCard"> |
| 104 | + {{<card-layout >}} |
| 105 | + {{<card-section showAsCards="true">}} |
| 106 | + {{<card title="Everything" titleUrl="everything" icon="circle-dot-dashed">}} |
| 107 | + All shortcodes in one page. |
| 108 | + {{</card >}} |
| 109 | + {{<card title="Call Out usages" titleUrl="call-out/all-callouts/" icon="message-square">}} |
| 110 | + Examples for call-out shortcode |
| 111 | + {{</card >}} |
| 112 | + {{<card title="Code Block usages" titleUrl="code-blocks/code-blocks-highlighting/" icon="code" isFeaturedCard="true">}} |
| 113 | + Examples for codeblock shortcode |
| 114 | + {{</card >}} |
| 115 | + {{<card title="Code Block usages" titleUrl="code-blocks/code-blocks-highlighting/" icon="code">}} |
| 116 | + Examples for codeblock shortcode |
| 117 | + {{</card >}} |
| 118 | + {{</card-section>}} |
| 119 | + {{</card-layout >}} |
| 120 | +</div> |
0 commit comments