|
1 | 1 | import React, { PropsWithChildren, useId } from "react"; |
2 | 2 | import styles from "./card.module.scss"; |
3 | 3 | import { clsx } from "clsx"; |
4 | | -import { getLocalizedSecondaryFont, MonoFont } from "@/libs/theme/fonts"; |
| 4 | +import { getLocalizedSecondaryFont } from "@/libs/theme/fonts"; |
5 | 5 | import { CardMessageComponent } from "@/features/common/components/card-message/card-message.component"; |
6 | 6 | import { HeaderIcon } from "../icons/header/header-icon"; |
7 | 7 | import { CheckIcon } from "../icons/check/check-icon"; |
| 8 | +import { EncodingFormatToggleSwitchComponent } from "@/features/decoder/components/encoding-format-toggle-swith/encoding-format-toggle-switch"; |
| 9 | +import { useDecoderStore } from "@/features/decoder/services/decoder.store"; |
| 10 | +import { isHmacAlg } from "../../services/jwt.service"; |
| 11 | +import { TokenDecoderKeyFormatPickerComponent } from "@/features/decoder/components/token-decoder-key-format-picker.component"; |
8 | 12 |
|
9 | 13 | export interface CardComponentProps extends PropsWithChildren { |
10 | 14 | id: string; |
@@ -150,10 +154,10 @@ export const CardComponent: React.FC<CardComponentProps> = (props) => { |
150 | 154 | > |
151 | 155 | {messages.success.map((line, index) => { |
152 | 156 | return ( |
153 | | - <> |
154 | | - <CheckIcon /> |
155 | | - <CardMessageComponent key={index}>{line}</CardMessageComponent> |
156 | | - </> |
| 157 | + <div key={index} style={{ display: "flex" }}> |
| 158 | + <CheckIcon /> |
| 159 | + <CardMessageComponent key={index}>{line}</CardMessageComponent> |
| 160 | + </div> |
157 | 161 | ); |
158 | 162 | })} |
159 | 163 | </div> |
@@ -197,31 +201,40 @@ export const CardWithHeadlineComponent: React.FC< |
197 | 201 | CardWithHeadlineComponentProps |
198 | 202 | > = ({ sectionHeadline, languageCode, ...props }) => { |
199 | 203 | const regionId = useId(); |
| 204 | + const alg$ = useDecoderStore((state) => state.alg); |
200 | 205 |
|
201 | 206 | return ( |
202 | 207 | <div role="region" aria-labelledby={regionId}> |
203 | 208 | {sectionHeadline && ( |
204 | | - <> |
205 | | - <h3 |
206 | | - id={regionId} |
207 | | - className={clsx( |
208 | | - styles.cardHeadline__title, |
209 | | - getLocalizedSecondaryFont(languageCode) |
210 | | - )} |
211 | | - > |
212 | | - {sectionHeadline.title} |
213 | | - {sectionHeadline.titleTag && ( |
214 | | - <span className={styles.cardHeadline__titleTag}> |
215 | | - {sectionHeadline.titleTag} |
216 | | - </span> |
| 209 | + <div className={styles.title__container}> |
| 210 | + <div> |
| 211 | + <h3 |
| 212 | + id={regionId} |
| 213 | + className={clsx( |
| 214 | + styles.cardHeadline__title, |
| 215 | + getLocalizedSecondaryFont(languageCode) |
| 216 | + )} |
| 217 | + > |
| 218 | + {sectionHeadline.title} |
| 219 | + {sectionHeadline.titleTag && ( |
| 220 | + <span className={styles.cardHeadline__titleTag}> |
| 221 | + {sectionHeadline.titleTag} |
| 222 | + </span> |
| 223 | + )} |
| 224 | + </h3> |
| 225 | + {sectionHeadline.description && ( |
| 226 | + <p className={styles.cardHeadline__description}> |
| 227 | + {sectionHeadline.description} |
| 228 | + </p> |
217 | 229 | )} |
218 | | - </h3> |
219 | | - {sectionHeadline.description && ( |
220 | | - <p className={styles.cardHeadline__description}> |
221 | | - {sectionHeadline.description} |
222 | | - </p> |
| 230 | + </div> |
| 231 | + |
| 232 | + {isHmacAlg(alg$) ? ( |
| 233 | + <EncodingFormatToggleSwitchComponent languageCode={languageCode} /> |
| 234 | + ) : ( |
| 235 | + <TokenDecoderKeyFormatPickerComponent languageCode={languageCode} /> |
223 | 236 | )} |
224 | | - </> |
| 237 | + </div> |
225 | 238 | )} |
226 | 239 | <CardComponent languageCode={languageCode} {...props} /> |
227 | 240 | </div> |
|
0 commit comments