Skip to content

Commit

Permalink
Merge pull request #40 from frankodoom/development
Browse files Browse the repository at this point in the history
Updating master
  • Loading branch information
frankodoom authored Oct 29, 2024
2 parents 0dff420 + 20d7e32 commit 75005b2
Show file tree
Hide file tree
Showing 37 changed files with 2,612 additions and 59 deletions.
Binary file added Assets/CountryData.Net.Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Assets/logo.png
Binary file not shown.
21 changes: 14 additions & 7 deletions CountryData.Standard.sln
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "doc", "doc", "{131F8946-782
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Assets", "Assets", "{3803AB02-5C70-4523-AA4E-8BEE9AD6D592}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CountryData.Sample.Web.API", "sample\CountryData.Sample.Web.API\CountryData.Sample.Web.API.csproj", "{787E809D-2E54-47F0-A5CB-8C0D383D327E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CountryData.Sample.MAUI", "sample\CountryData.Sample.MAUI\CountryData.Sample.MAUI\CountryData.Sample.MAUI.csproj", "{2EBA3AC1-C3FE-47B0-8606-917BA212E6AB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CountryData.Sample.Web.API", "sample\CountryData.Sample.Web.API\CountryData.Sample.Web.API.csproj", "{A77E8CA8-11B9-41B4-A00C-46BD55756CF5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CountryData.Sample.Blazor", "sample\CountryData.Sample.Blazor\CountryData.Sample.Blazor.csproj", "{6820CA38-0AB5-4532-9A26-DE9533BA2538}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -53,16 +55,20 @@ Global
{397666FE-700B-446E-B4EC-13ACF0DDDEBE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{397666FE-700B-446E-B4EC-13ACF0DDDEBE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{397666FE-700B-446E-B4EC-13ACF0DDDEBE}.Release|Any CPU.Build.0 = Release|Any CPU
{787E809D-2E54-47F0-A5CB-8C0D383D327E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{787E809D-2E54-47F0-A5CB-8C0D383D327E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{787E809D-2E54-47F0-A5CB-8C0D383D327E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{787E809D-2E54-47F0-A5CB-8C0D383D327E}.Release|Any CPU.Build.0 = Release|Any CPU
{2EBA3AC1-C3FE-47B0-8606-917BA212E6AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2EBA3AC1-C3FE-47B0-8606-917BA212E6AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2EBA3AC1-C3FE-47B0-8606-917BA212E6AB}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{2EBA3AC1-C3FE-47B0-8606-917BA212E6AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2EBA3AC1-C3FE-47B0-8606-917BA212E6AB}.Release|Any CPU.Build.0 = Release|Any CPU
{2EBA3AC1-C3FE-47B0-8606-917BA212E6AB}.Release|Any CPU.Deploy.0 = Release|Any CPU
{A77E8CA8-11B9-41B4-A00C-46BD55756CF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A77E8CA8-11B9-41B4-A00C-46BD55756CF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A77E8CA8-11B9-41B4-A00C-46BD55756CF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A77E8CA8-11B9-41B4-A00C-46BD55756CF5}.Release|Any CPU.Build.0 = Release|Any CPU
{6820CA38-0AB5-4532-9A26-DE9533BA2538}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6820CA38-0AB5-4532-9A26-DE9533BA2538}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6820CA38-0AB5-4532-9A26-DE9533BA2538}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6820CA38-0AB5-4532-9A26-DE9533BA2538}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -71,8 +77,9 @@ Global
{BFFCBBCD-4DD4-4EBE-8282-A4694E6A0ECA} = {EBEF4582-3E32-4FBA-92CA-335DD47C2B4B}
{A450767F-7970-4A30-834E-3E086B87D925} = {420B8450-0A31-431D-90B0-A5C9C7B314C9}
{397666FE-700B-446E-B4EC-13ACF0DDDEBE} = {BBA69DE8-BE26-498E-9A62-131EB2494972}
{787E809D-2E54-47F0-A5CB-8C0D383D327E} = {BBA69DE8-BE26-498E-9A62-131EB2494972}
{2EBA3AC1-C3FE-47B0-8606-917BA212E6AB} = {BBA69DE8-BE26-498E-9A62-131EB2494972}
{A77E8CA8-11B9-41B4-A00C-46BD55756CF5} = {BBA69DE8-BE26-498E-9A62-131EB2494972}
{6820CA38-0AB5-4532-9A26-DE9533BA2538} = {BBA69DE8-BE26-498E-9A62-131EB2494972}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CD61C5EF-9299-42A8-81E2-D96FAF1BC81D}
Expand Down
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# :earth_africa: CountryData.Net
[![Gitter](https://badges.gitter.im/CountryDataDotnet/community.svg)](https://gitter.im/CountryDataDotnet/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
A simple cross-platform offline .NET library for getting Global Country Data without making any HTTP calls.
<!-- logo -->

![Logo](./Assets/CountryData.Net.Logo.png)


| | |
Expand All @@ -20,6 +20,7 @@ A simple cross-platform offline .NET library for getting Global Country Data wit
- 🗺️ Get country region by ISO 3166 country code
- ☎️ Get country phone code by ISO 3166 country code


### Install Library
##### Package Manager
```cSharp
Expand All @@ -42,6 +43,26 @@ For more detailed instructions and comprehensive information about the library,




### Methods and Descriptions

The CountryData.Standard library provides a set of methods that allow you to retrieve country data, flags, regions, and phone codes. The following table lists the available methods and their descriptions.

| Method | Description |
|--------|-------------|
| [`GetCountryData()`](./docs/README.md) | Returns all country data including region, short code, and country name. |
| [`GetCountryByCode(string shortCode)`](./docs/README.md) | Returns a single country's data by its short code. |
| [`GetCountryEmojiFlag(string shortCode)`](./docs/README.md) | Gets the flag of the country, represented as an emoji, by the country's short code. |
| [`GetRegionByCountryCode(string shortCode)`](./docs/README.md) | Selects and returns a list of regions for a particular country identified by its short code. |
| [`GetCountries()`](./docs/README.md) | Gets the list of all country names. |
| [`GetPhoneCodeByCountryShortCode(string shortCode)`](./docs/README.md) | Returns a single country's phone code by its short code. |
| [`GetCountryByPhoneCode(string phoneCode)`](./docs/README.md) | Returns country data for the country associated with the specified phone code. |
| [`GetCurrencyCodesByCountryCode(string shortCode)`](./docs/README.md) | Returns a list of currency codes for a specific country identified by its short code. |
| [`GetCountryByCurrencyCode(string currencyCode)`](./docs/README.md) | Returns a list of countries that use the specified currency code. |
| [`GetCountryCode(string countryName)`](./docs/README.md) | Returns the country code for a specific country name. |



### Initialize the Country data object

```cSharp
Expand Down Expand Up @@ -81,7 +102,7 @@ For more detailed instructions and comprehensive information about the library,
.ToList();
```


### Get Country Data by Country Code
This example demonstrates how to retrieve a country with a specific phone code using the `GetCountryByPhoneCode` method. In this case, we're fetching the country with the phone code "+233".

```csharp
Expand Down Expand Up @@ -111,7 +132,6 @@ We are committed to fostering a welcoming and respectful community for everyone.
* Country ShortCode Enums



### License

This project is licensed under the terms of the [LICENSE](LICENSE).
45 changes: 42 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ This method is particularly useful for applications that need to display or anal



### GetCountryEmojiFlag(string shortCode)
### GetCountryEmojiFlag (string shortCode)

The `GetCountryEmojiFlag()` method is designed to fetch the flag of a specific country using its ISO 3166-1 alpha-2 code. This method provides a simple and effective way to visually represent countries in your application.
The `GetCountryEmojiFlag ()` method is designed to fetch the flag of a specific country using its ISO 3166-1 alpha-2 code. This method provides a simple and effective way to visually represent countries in your application.

Here's the method signature in C#:

```csharp
string GetCountryEmojiFlag(string shortCode);
string GetCountryFlag (string shortCode);
```

This method returns the em flag of the country corresponding to the provided ISO code. It's particularly useful when you need to display a country's flag in a user interface or in text-based communication.
Expand Down Expand Up @@ -159,4 +159,43 @@ Country GetCountryByPhoneCode(string phoneCode);
This method is particularly useful when you have a phone code and need to retrieve the corresponding country's information. Simply pass the phone code as a string argument, and the method will return a `Country` object filled with relevant data.


### GetCurrencyCodesByCountryCode(string shortCode)

The `GetCurrencyCodesByCountryCode()` method is designed to fetch the currency codes used in a specific country using its ISO 3166-1 alpha-2 code. This method returns a `List<string>`, with each string representing a distinct currency code used in the specified country.

Here's the method signature in C#:

```csharp

List<string> GetCurrencyCodesByCountryCode(string shortCode);
```

This method is particularly useful for applications that need to display or analyze currency data within a specific country. Simply pass the country

### GetCountryByCurrencyCode(string currencyCode)

The `GetCountryByCurrencyCode()` method is designed to fetch detailed data for a specific country using its currency code. This method returns a `Country` object, providing a wealth of information about the country, including its name, region, flag, and ISO code.

Here's the method signature in C#:

```csharp

Country GetCountryByCurrencyCode(string currencyCode);
```

This method is particularly useful when you have a currency code and need to retrieve the corresponding country's information. Simply pass the currency code as a string argument, and the method will return a `Country` object filled with relevant data.


### GetCountryCode(string countryName)

The `GetCountryCode()` method is designed to fetch the ISO 3166-1 alpha-2 code for a specific country using its name. This method returns a string containing the country's ISO code, making it easy to identify countries based on their names.

Here's the method signature in C#:

```csharp

string GetCountryCode(string countryName);
```



20 changes: 20 additions & 0 deletions sample/CountryData.Sample.Blazor/Components/App.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="/" />
<link rel="stylesheet" href="bootstrap/bootstrap.min.css" />
<link rel="stylesheet" href="app.css" />
<link rel="stylesheet" href="CountryData.Sample.Blazor.styles.css" />
<link rel="icon" type="image/png" href="favicon.png" />
<HeadOutlet />
</head>

<body>
<Routes />
<script src="_framework/blazor.web.js"></script>
</body>

</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@inherits LayoutComponentBase

<div class="page">
<div class="sidebar">
<NavMenu />
</div>

<main>
<div class="top-row px-4">
<a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a>
</div>

<article class="content px-4">
@Body
</article>
</main>
</div>

<div id="blazor-error-ui">
An unhandled error has occurred.
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
.page {
position: relative;
display: flex;
flex-direction: column;
}

main {
flex: 1;
}

.sidebar {
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
}

.top-row {
background-color: #f7f7f7;
border-bottom: 1px solid #d6d5d5;
justify-content: flex-end;
height: 3.5rem;
display: flex;
align-items: center;
}

.top-row ::deep a, .top-row ::deep .btn-link {
white-space: nowrap;
margin-left: 1.5rem;
text-decoration: none;
}

.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
text-decoration: underline;
}

.top-row ::deep a:first-child {
overflow: hidden;
text-overflow: ellipsis;
}

@media (max-width: 640.98px) {
.top-row {
justify-content: space-between;
}

.top-row ::deep a, .top-row ::deep .btn-link {
margin-left: 0;
}
}

@media (min-width: 641px) {
.page {
flex-direction: row;
}

.sidebar {
width: 250px;
height: 100vh;
position: sticky;
top: 0;
}

.top-row {
position: sticky;
top: 0;
z-index: 1;
}

.top-row.auth ::deep a:first-child {
flex: 1;
text-align: right;
width: 0;
}

.top-row, article {
padding-left: 2rem !important;
padding-right: 1.5rem !important;
}
}

#blazor-error-ui {
background: lightyellow;
bottom: 0;
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
display: none;
left: 0;
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
position: fixed;
width: 100%;
z-index: 1000;
}

#blazor-error-ui .dismiss {
cursor: pointer;
position: absolute;
right: 0.75rem;
top: 0.5rem;
}
23 changes: 23 additions & 0 deletions sample/CountryData.Sample.Blazor/Components/Layout/NavMenu.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<div class="top-row ps-3 navbar navbar-dark">
<div class="container-fluid">
<a class="navbar-brand" href="">CountryData.Sample.Blazor</a>
</div>
</div>

<input type="checkbox" title="Navigation menu" class="navbar-toggler" />

<div class="nav-scrollable" onclick="document.querySelector('.navbar-toggler').click()">
<nav class="flex-column">
<div class="nav-item px-3">
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home
</NavLink>
</div>





</nav>
</div>

Loading

0 comments on commit 75005b2

Please sign in to comment.