From 54e1fde3fbc907065906ab92722bbf74f82221a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Pablo=20Guti=C3=A9rrez=20Restrepo?= Date: Fri, 27 Jan 2023 13:25:12 +0900 Subject: [PATCH] Added AutoWidth option to TwitterTimelineEmbed --- src/components/TwitterTimelineEmbed.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/TwitterTimelineEmbed.tsx b/src/components/TwitterTimelineEmbed.tsx index e3cae78..a899842 100644 --- a/src/components/TwitterTimelineEmbed.tsx +++ b/src/components/TwitterTimelineEmbed.tsx @@ -20,6 +20,10 @@ export interface TwitterTimelineEmbedBase { * Automatically fit into parent container height */ autoHeight?: boolean; + /** + * Automatically fit into parent container width + */ + autoWidth?: boolean; /** * With dark or light theme */ @@ -235,6 +239,9 @@ const TwitterTimelineEmbed = (props: TwitterTimelineEmbedPropsType): any => { if (props?.autoHeight) { options.height = (ref.current?.parentNode as HTMLElement)?.offsetHeight; } + if (props?.autoWidth) { + options.width = (ref.current?.parentNode as HTMLElement)?.offsetWidth; + } options = Object.assign({}, options, { theme: props?.theme,