File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
packages/sveltekit-embed/src/lib/components Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change 66
77 let { tweetLink = ' ' , theme = ' light' }: Props = $props ();
88
9- let twitter_widgets_script: HTMLScriptElement | null = null ;
9+ let twitter_widgets_script = $state .raw <HTMLScriptElement | null >(
10+ null ,
11+ );
1012
1113 const load_twitter_widgets_script = () => {
1214 if (twitter_widgets_script ) return ;
3234 });
3335 </script >
3436
35- <div class =" tweet-wrapper" >
37+ <div
38+ class =" tweet-wrapper"
39+ data-theme ={theme }
40+ data-loaded ={twitter_widgets_script != null }
41+ >
3642 <blockquote class ="twitter-tweet" data-theme ={theme }>
3743 <a href ={` https://twitter.com/${tweetLink } ` }>Loading Tweet...</a >
3844 </blockquote >
3945</div >
4046
4147<style >
48+ :root {
49+ --twitter-embed-bg-light : #ffffff ;
50+ --twitter-embed-bg-dark : #151d26 ;
51+ }
52+
4253 .tweet-wrapper {
4354 display : flex ;
4455 justify-content : center ;
4556 margin-bottom : 12px ;
4657 }
4758
59+ .tweet-wrapper [data-theme = ' light' ][data-loaded = ' true' ] {
60+ background-color : var (--twitter-embed-bg-light );
61+ }
62+
63+ .tweet-wrapper [data-theme = ' dark' ][data-loaded = ' true' ] {
64+ background-color : var (--twitter-embed-bg-dark );
65+ }
66+
4867 .twitter-tweet {
4968 display : block ;
5069 margin : 0 ;
You can’t perform that action at this time.
0 commit comments