File tree Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Original file line number Diff line number Diff line change 1
1
import { Children , FunctionComponent } from 'react' ;
2
- import { useLayoutContext , DEFAULT_LANGUAGE } from 'src/contexts/layout-context' ;
2
+ import { useLayoutContext } from 'src/contexts/layout-context' ;
3
3
4
- export const DlWrapper : FunctionComponent < unknown > = ( { children } ) => {
4
+ type DlWrapperProps = {
5
+ children : React . ReactElement < {
6
+ attribs ?: {
7
+ lang ?: string ;
8
+ } ;
9
+ } > [ ] ;
10
+ } ;
11
+
12
+ export const DlWrapper : FunctionComponent < DlWrapperProps > = ( { children } ) => {
5
13
const { activePage } = useLayoutContext ( ) ;
6
14
7
15
return Children . map ( children , ( child ) => {
8
16
const attribs = child ?. props ?. attribs ;
9
17
10
18
if ( attribs ?. lang ) {
11
- if (
12
- ( activePage . language === DEFAULT_LANGUAGE && attribs ?. lang === DEFAULT_LANGUAGE ) ||
13
- attribs ?. lang === activePage . language ||
14
- attribs ?. lang === DEFAULT_LANGUAGE
15
- ) {
19
+ if ( attribs . lang === activePage . language ) {
16
20
return child ;
17
21
}
18
22
return null ;
Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ import Icon from '@ably/ui/core/Icon';
4
4
import Html from '../Html' ;
5
5
import LocalLanguageAlternatives from '../wrappers/LocalLanguageAlternatives' ;
6
6
import {
7
- DEFAULT_LANGUAGE ,
8
7
DEFAULT_PREFERRED_INTERFACE ,
9
8
DEFAULT_PREFERRED_LANGUAGE ,
10
9
REALTIME_SDK_INTERFACE ,
@@ -67,8 +66,7 @@ const Pre = ({
67
66
68
67
const codeClassName = 'bg-cool-black text-white p-0 rounded-lg relative max-w-[calc(100vw-48px)] sm:max-w-full' ;
69
68
70
- const hasCode =
71
- languages ?. some ( ( lang ) => getTrimmedLanguage ( lang ) === pageLanguage ) || pageLanguage === DEFAULT_LANGUAGE ;
69
+ const hasCode = languages ?. some ( ( lang ) => getTrimmedLanguage ( lang ) === pageLanguage ) ;
72
70
const shouldDisplayTip = ! hasCode && languages ?. length !== undefined ;
73
71
const withModifiedClassname = {
74
72
...attribs ,
You can’t perform that action at this time.
0 commit comments