-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update kotlin-react-intl wrapper to v5.21.0
- Loading branch information
samgarasx
committed
Oct 23, 2021
1 parent
66818d9
commit ad3db88
Showing
10 changed files
with
49 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
kotlin-react-intl/react-intl-samples/src/main/kotlin/samples/Plural.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package samples | ||
|
||
import kotlinx.html.js.onClickFunction | ||
import react.* | ||
import react.dom.button | ||
import reactintl.components.plural.formattedPlural | ||
import reactintl.components.provider.intlProvider | ||
|
||
private val app = fc<Props> { | ||
val (dogs, setDogs) = useState(1) | ||
|
||
intlProvider { | ||
attrs { | ||
locale = "en" | ||
defaultLocale = "en" | ||
} | ||
formattedPlural { | ||
attrs { | ||
value = dogs | ||
one = ReactNode("I have a unique dog") | ||
other = ReactNode("I have $dogs dogs") | ||
} | ||
} | ||
button { | ||
attrs.onClickFunction = { setDogs(dogs + 1) } | ||
+"Add dogs" | ||
} | ||
} | ||
} | ||
|
||
fun RBuilder.plural() = child(app) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters