Add C# pages.
This commit is contained in:
parent
cb36f9d948
commit
40df538cc6
15
src/App.js
15
src/App.js
@ -44,7 +44,7 @@ import JapanesePage from './Pages/Japan/JapanesePage';
|
|||||||
import EquipmentPage from './Pages/Radio/equipmentPage';
|
import EquipmentPage from './Pages/Radio/equipmentPage';
|
||||||
|
|
||||||
import { languages, getLanguage } from './Language/Language';
|
import { languages, getLanguage } from './Language/Language';
|
||||||
import { elmRoutes, japaneseRoutes } from './Routers';
|
import { japaneseRoutes, programmingLanguageRoutes } from './Routers';
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const language = getLanguage();
|
const language = getLanguage();
|
||||||
@ -57,6 +57,8 @@ function App() {
|
|||||||
'software': <SoftwareMain />,
|
'software': <SoftwareMain />,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const fieldDaysRoutes = languages.map(lang => {
|
const fieldDaysRoutes = languages.map(lang => {
|
||||||
const dates = ['20231111', '20231230', '20240121'];
|
const dates = ['20231111', '20231230', '20240121'];
|
||||||
return dates.map(date => {
|
return dates.map(date => {
|
||||||
@ -66,6 +68,14 @@ function App() {
|
|||||||
});
|
});
|
||||||
}).flat();
|
}).flat();
|
||||||
|
|
||||||
|
const componentRoutes = languages.map(lang => {
|
||||||
|
const components = ['diode'];
|
||||||
|
return components.map(component => {
|
||||||
|
const path = `/${lang}/radio/component/${component}`;
|
||||||
|
return <Route key={`${lang}-${component}`} exact path={path} element={<Component component={component} />} />;
|
||||||
|
});
|
||||||
|
}).flat();
|
||||||
|
|
||||||
const equipmentRoutes = languages.map(lang => {
|
const equipmentRoutes = languages.map(lang => {
|
||||||
const equipments = [
|
const equipments = [
|
||||||
{
|
{
|
||||||
@ -116,7 +126,8 @@ function App() {
|
|||||||
{generatedRoutes}
|
{generatedRoutes}
|
||||||
|
|
||||||
{/* Software */}
|
{/* Software */}
|
||||||
{elmRoutes}
|
{programmingLanguageRoutes}
|
||||||
|
|
||||||
<Route exact path='/software/dxp-development' element={<DXPDevelopment />}></Route>
|
<Route exact path='/software/dxp-development' element={<DXPDevelopment />}></Route>
|
||||||
<Route exact path='/software/configuration-automation' element={<ConfigAutomation />}></Route>
|
<Route exact path='/software/configuration-automation' element={<ConfigAutomation />}></Route>
|
||||||
<Route exact path='/software/wifi-prototype' element={<WifiPrototype />}></Route>
|
<Route exact path='/software/wifi-prototype' element={<WifiPrototype />}></Route>
|
||||||
|
|||||||
@ -15,7 +15,10 @@ const SoftwareMain = () => {
|
|||||||
<hr />
|
<hr />
|
||||||
<h2>{getString('code_pages')}</h2>
|
<h2>{getString('code_pages')}</h2>
|
||||||
<p>{getString('code_pages_intro')}</p>
|
<p>{getString('code_pages_intro')}</p>
|
||||||
<a href={'/' + language + '/software/elm/'}>Elm</a>
|
<ul>
|
||||||
|
<li><a href={'/' + language + '/software/csharp/'}>C#</a></li>
|
||||||
|
<li><a href={'/' + language + '/software/elm/'}>Elm</a></li>
|
||||||
|
</ul>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<h2>{getString('education')}</h2>
|
<h2>{getString('education')}</h2>
|
||||||
|
|||||||
16
src/Pages/Software/csharp/CSharpPage.js
Normal file
16
src/Pages/Software/csharp/CSharpPage.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Breadcrumbs from '../../../UI/Breadcrumbs'
|
||||||
|
import MarkdownPage from '../../markdownPage'
|
||||||
|
|
||||||
|
const CSharpPage = ({ mdPath }) => {
|
||||||
|
return (
|
||||||
|
<article className='main-page'>
|
||||||
|
<Breadcrumbs separator=' > ' path="software/csharp">
|
||||||
|
{['software', 'c#']}
|
||||||
|
</Breadcrumbs>
|
||||||
|
<MarkdownPage md={mdPath} />
|
||||||
|
</article>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CSharpPage;
|
||||||
6
src/Pages/Software/csharp/en/main.md
Normal file
6
src/Pages/Software/csharp/en/main.md
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
## C#
|
||||||
|
|
||||||
|
#### Basics
|
||||||
|
|
||||||
|
* [types](./types)
|
||||||
|
* [strings](./strings)
|
||||||
49
src/Pages/Software/csharp/en/strings.md
Normal file
49
src/Pages/Software/csharp/en/strings.md
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
## Strings
|
||||||
|
|
||||||
|
#### Verbatim string with @:
|
||||||
|
|
||||||
|
Preserves whitespace and characters like '\' do not need to be escaped.
|
||||||
|
|
||||||
|
```c#
|
||||||
|
Console.WriteLine(@" c:\source\repos
|
||||||
|
(this is where your code goes)");
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
```
|
||||||
|
> c:\source\repos
|
||||||
|
> (this is where your code goes)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Escaped Unicode
|
||||||
|
|
||||||
|
Use the **\u** plus a four-character code to represent Unicode characters (UTF-16) in a string.
|
||||||
|
|
||||||
|
[Japanese UTF-16 table](http://www.rikai.com/library/kanjitables/kanji_codes.unicode.shtml)
|
||||||
|
|
||||||
|
```c#
|
||||||
|
Console.WriteLine("\u3053\u3093\u306B\u3061\u306F World!");
|
||||||
|
```
|
||||||
|
|
||||||
|
Output (UTF-16):
|
||||||
|
```
|
||||||
|
> こんにちは World!
|
||||||
|
```
|
||||||
|
|
||||||
|
```c#
|
||||||
|
// To generate Japanese invoices:
|
||||||
|
Console.Write("\n\n\u65e5\u672c\u8a9e\u306e\u8acb\u6c42\u66f8\u3092\u751f\u6210\u3059\u308b\u306b\u306f\uff1a");
|
||||||
|
```
|
||||||
|
|
||||||
|
Output (UTF-16):
|
||||||
|
```
|
||||||
|
> 日本語の請求書を生成するには:
|
||||||
|
```
|
||||||
|
|
||||||
|
#### String interpolation
|
||||||
|
|
||||||
|
Can be combined with verbatim strings.
|
||||||
|
|
||||||
|
```c#
|
||||||
|
Console.WriteLine($@"C:\Output\{projectName}\Data");
|
||||||
|
```
|
||||||
10
src/Pages/Software/csharp/en/types.md
Normal file
10
src/Pages/Software/csharp/en/types.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
## Types
|
||||||
|
|
||||||
|
Float Type Precision
|
||||||
|
|
||||||
|
float ~6-9 digits 0.25F
|
||||||
|
double ~15-17 digits 0.25
|
||||||
|
decimal 28-29 digits 0.25M
|
||||||
|
|
||||||
|
Both lowercase 'f' or 'F' can be used, same for 'm' and 'M'.
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
### Elm
|
## Elm
|
||||||
|
|
||||||
* [Formatting](./formatting)
|
* [Formatting](./formatting)
|
||||||
* [Maybe.andThen](./maybeandthen)
|
* [Maybe.andThen](./maybeandthen)
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import React from 'react';
|
|||||||
import { Route } from 'react-router-dom';
|
import { Route } from 'react-router-dom';
|
||||||
import { languages } from './Language/Language';
|
import { languages } from './Language/Language';
|
||||||
import JapanesePage from './Pages/Japan/JapanesePage';
|
import JapanesePage from './Pages/Japan/JapanesePage';
|
||||||
|
import CSharpPage from './Pages/Software/csharp/CSharpPage';
|
||||||
import ElmPage from './Pages/Software/elm/ElmPage';
|
import ElmPage from './Pages/Software/elm/ElmPage';
|
||||||
|
|
||||||
|
|
||||||
@ -16,17 +17,26 @@ export const japaneseRoutes = languages.map(lang => {
|
|||||||
}).flat();
|
}).flat();
|
||||||
|
|
||||||
// Software
|
// Software
|
||||||
export const elmRoutes = languages.map(lang => {
|
export const programmingLanguageRoutes = languages.map(lang => {
|
||||||
// Main page.
|
// Main page.
|
||||||
const main = <Route key={`${lang}-elm-main`} exact path={`/${lang}/software/elm/`} element={<ElmPage mdPath={`Software/elm/${lang}/main.md`} />} />
|
const mainCSharp = <Route key={`${lang}-csharp-main`} exact path={`/${lang}/software/csharp/`} element={<CSharpPage mdPath={`Software/csharp/${lang}/main.md`} />} />
|
||||||
|
const mainElm = <Route key={`${lang}-elm-main`} exact path={`/${lang}/software/elm/`} element={<ElmPage mdPath={`Software/elm/${lang}/main.md`} />} />
|
||||||
|
|
||||||
// Pages within Elm.
|
// Pages within Elm.
|
||||||
const md = ['dry', 'formatting', 'maybeandthen', 'maybemap'];
|
let md = ['strings', 'types'];
|
||||||
const entries = md.map(entry => {
|
const entriesCSharp = md.map(entry => {
|
||||||
|
const path = `/${lang}/software/csharp/${entry}`;
|
||||||
|
const mdPath = `Software/csharp/${lang}/${entry}.md`;
|
||||||
|
return <Route key={`${lang}-${entry}`} exact path={path} element={<CSharpPage mdPath={mdPath} />} />;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Pages within Elm.
|
||||||
|
md = ['dry', 'formatting', 'maybeandthen', 'maybemap'];
|
||||||
|
const entriesElm = md.map(entry => {
|
||||||
const path = `/${lang}/software/elm/${entry}`;
|
const path = `/${lang}/software/elm/${entry}`;
|
||||||
const mdPath = `Software/elm/${lang}/${entry}.md`;
|
const mdPath = `Software/elm/${lang}/${entry}.md`;
|
||||||
return <Route key={`${lang}-${entry}`} exact path={path} element={<ElmPage mdPath={mdPath} />} />;
|
return <Route key={`${lang}-${entry}`} exact path={path} element={<ElmPage mdPath={mdPath} />} />;
|
||||||
});
|
});
|
||||||
|
|
||||||
return [main, ...entries];
|
return [mainCSharp, mainElm, ...entriesCSharp, ...entriesElm];
|
||||||
}).flat();
|
}).flat();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user