File tree Expand file tree Collapse file tree 3 files changed +20
-17
lines changed
Expand file tree Collapse file tree 3 files changed +20
-17
lines changed Original file line number Diff line number Diff line change 11import React , { Component } from 'react'
22
33import Table from './Table'
4-
54import { OrderFormItem } from '../typings/orderForm'
65
7- class CustomButton extends Component < CustomButtonProps , CustomButtonState > {
8- /**
9- * This component is responsible for rendering the custom button itself. For instance,
10- * we use it to render a table that contains the name of the items that are in the
11- * order form.
12- */
13- constructor ( props : any ) {
14- super ( props )
15- }
16- render ( ) {
6+ /**
7+ * This component is responsible for rendering the custom button itself. For instance,
8+ * we use it to render a table that contains the name of the items that are in the
9+ * order form.
10+ */
11+ class CustomButton extends Component < CustomButtonProps , { } > {
12+ public render ( ) {
1713 const { items } = this . props
1814
1915 return items ? (
@@ -31,6 +27,6 @@ interface CustomButtonProps {
3127 items : OrderFormItem [ ]
3228}
3329
34- interface CustomButtonState { }
30+ // interface CustomButtonState {}
3531
3632export default CustomButton
Original file line number Diff line number Diff line change @@ -3,8 +3,8 @@ import React, { Component } from 'react'
33import CustomButton from './components/CustomButton'
44import { OrderForm } from './typings/orderForm'
55
6- class CheckoutButtonExample extends Component <
7- CheckoutButtonExampleProps ,
6+ class CheckoutButtonExample extends React . Component <
7+ { } ,
88 CheckoutButtonExampleState
99> {
1010 /**
@@ -20,19 +20,22 @@ class CheckoutButtonExample extends Component<
2020 }
2121 }
2222
23- listenOrderFormUpdated = ( ) => {
23+ public listenOrderFormUpdated ( ) {
2424 $ ( window ) . on ( 'orderFormUpdated.vtex' , ( _ : any , orderForm : OrderForm ) =>
2525 this . setState ( { orderForm } )
2626 )
2727 }
2828
29- render ( ) {
29+ public render ( ) {
3030 this . listenOrderFormUpdated ( )
31+
32+ console . log ( window . vtex . i18n . getLocale ( ) )
33+
3134 return < CustomButton { ...this . state . orderForm ! } />
3235 }
3336}
3437
35- interface CheckoutButtonExampleProps { }
38+ // interface CheckoutButtonExampleProps {}
3639
3740interface CheckoutButtonExampleState {
3841 orderForm : OrderForm | null
Original file line number Diff line number Diff line change 1+ declare global {
2+ type Window = any
3+ }
4+
15export interface OrderFormContext {
26 orderForm : OrderForm
37 loading : boolean
You can’t perform that action at this time.
0 commit comments