Skip to content

Commit

Permalink
docs: update react-country-dropdown to 2.2.0 and simplify json format…
Browse files Browse the repository at this point in the history
…ting
  • Loading branch information
rocktimsaikia committed Aug 5, 2024
1 parent 1a09544 commit 588c67c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@radix-ui/react-icons": "^1.3.0",
"react": "^18.3.1",
"react-code-blocks": "^0.1.6",
"react-country-dropdown": "^2.1.0",
"react-country-dropdown": "^2.2.0",
"react-dom": "^18.3.1"
},
"devDependencies": {
Expand Down
10 changes: 5 additions & 5 deletions docs/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 1 addition & 12 deletions docs/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,7 @@ function App() {
const handleCountryChange = (country: ICountry) => {
// Convert the country object to a formatted JSON string
// where the arrays are in one line and spaces after commas.
const formattedCountry = JSON.stringify(
country,
(_key, value) => {
if (Array.isArray(value)) {
return JSON.stringify(value);
}
return value;
},
4,
)
.replace(/"\[|\]"/g, (match) => (match === '"[' ? "[" : "]"))
.replace(/,/g, ", ");
const formattedCountry = JSON.stringify(country, null, 4);
setCountryJson(formattedCountry);
};

Expand Down

0 comments on commit 588c67c

Please sign in to comment.