-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.tsx
47 lines (44 loc) · 1.26 KB
/
example.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { Box, Bubble, Text, render, Carousel, FlexMessage, Image } from './src'
import React from 'react'
import dotenv from 'dotenv'
import { Client } from '@line/bot-sdk'
dotenv.config()
const element = (
<FlexMessage altText="Lorem ipsum!">
<Carousel>
<Bubble>
<Box layout="vertical">
<Text wrap>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua.
</Text>
</Box>
</Bubble>
<Bubble
hero={
<Image
url="https://i.imgur.com/mFHkiNw.png"
size="full"
aspectRatio="1.91:1"
/>
}
>
<Box layout="baseline">
<Text wrap flex={1} size="4xl" color="#ff0000">
Left
</Text>
<Text wrap flex={1} size="3xl" color="#0000ff" align="end">
Right
</Text>
</Box>
</Bubble>
</Carousel>
</FlexMessage>
)
const client = new Client({
channelAccessToken: process.env.CHANNEL_ACCESS_TOKEN,
channelSecret: process.env.CHANNEL_SECRET
})
const message = render(element)
console.log(require('util').inspect(message, { depth: 10 }))
client.pushMessage(process.env.MY_USER_ID, message)