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 11import { Children , FunctionComponent } from 'react' ;
2- import { useLayoutContext , DEFAULT_LANGUAGE } from 'src/contexts/layout-context' ;
2+ import { useLayoutContext } from 'src/contexts/layout-context' ;
33
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 } ) => {
513 const { activePage } = useLayoutContext ( ) ;
614
715 return Children . map ( children , ( child ) => {
816 const attribs = child ?. props ?. attribs ;
917
1018 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 ) {
1620 return child ;
1721 }
1822 return null ;
Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ import Icon from '@ably/ui/core/Icon';
44import Html from '../Html' ;
55import LocalLanguageAlternatives from '../wrappers/LocalLanguageAlternatives' ;
66import {
7- DEFAULT_LANGUAGE ,
87 DEFAULT_PREFERRED_INTERFACE ,
98 DEFAULT_PREFERRED_LANGUAGE ,
109 REALTIME_SDK_INTERFACE ,
@@ -67,8 +66,7 @@ const Pre = ({
6766
6867 const codeClassName = 'bg-cool-black text-white p-0 rounded-lg relative max-w-[calc(100vw-48px)] sm:max-w-full' ;
6968
70- const hasCode =
71- languages ?. some ( ( lang ) => getTrimmedLanguage ( lang ) === pageLanguage ) || pageLanguage === DEFAULT_LANGUAGE ;
69+ const hasCode = languages ?. some ( ( lang ) => getTrimmedLanguage ( lang ) === pageLanguage ) ;
7270 const shouldDisplayTip = ! hasCode && languages ?. length !== undefined ;
7371 const withModifiedClassname = {
7472 ...attribs ,
You can’t perform that action at this time.
0 commit comments