This repository has been archived by the owner on Aug 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Numerals to Psammead Locale (#1477)
Add Numerals to Psammead Locale
- Loading branch information
Showing
11 changed files
with
163 additions
and
9 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
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
30 changes: 30 additions & 0 deletions
30
packages/utilities/psammead-locales/numerals/index.stories.jsx
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,30 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import styled from 'styled-components'; | ||
import { GEL_SPACING } from '@bbc/gel-foundations/spacings'; | ||
import * as numerals from '../src/numerals'; | ||
|
||
const numeralSystems = Object.keys(numerals); | ||
const stories = storiesOf('Utilities|Psammead Locales', module); | ||
|
||
const Container = styled.div` | ||
padding: ${GEL_SPACING}; | ||
`; | ||
|
||
const Value = styled.div` | ||
display: inline-block; | ||
margin: ${GEL_SPACING}; | ||
`; | ||
|
||
stories.add('Numerals', () => { | ||
return ( | ||
<Container> | ||
{numeralSystems.map(numeralSystem => ( | ||
<div> | ||
<Value>{numeralSystem}</Value> | ||
<Value>{numerals[numeralSystem].join(', ')}</Value> | ||
</div> | ||
))} | ||
</Container> | ||
); | ||
}); |
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,7 @@ | ||
{ | ||
"name": "@bbc/psammead-locales/numerals", | ||
"private": "true", | ||
"main": "../dist/numerals", | ||
"module": "../esm/numerals", | ||
"sideEffects": false | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Empty file.
65 changes: 65 additions & 0 deletions
65
packages/utilities/psammead-locales/src/numerals/__snapshots__/index.test.js.snap
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,65 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Numerals should return Bengali numerals 1`] = ` | ||
Array [ | ||
"০", | ||
"১", | ||
"২", | ||
"৩", | ||
"৪", | ||
"৫", | ||
"৬", | ||
"৭", | ||
"৮", | ||
"৯", | ||
"১০", | ||
] | ||
`; | ||
|
||
exports[`Numerals should return Burmese numerals 1`] = ` | ||
Array [ | ||
"၀", | ||
"၁", | ||
"၂", | ||
"၃", | ||
"၄", | ||
"၅", | ||
"၆", | ||
"၇", | ||
"၈", | ||
"၉", | ||
"၁၀", | ||
] | ||
`; | ||
|
||
exports[`Numerals should return EasternArabic numerals 1`] = ` | ||
Array [ | ||
"۰", | ||
"۱", | ||
"۲", | ||
"۳", | ||
"۴", | ||
"۵", | ||
"۶", | ||
"۷", | ||
"۸", | ||
"۹", | ||
"۱۰", | ||
] | ||
`; | ||
|
||
exports[`Numerals should return WesternArabic numerals 1`] = ` | ||
Array [ | ||
"0", | ||
"1", | ||
"2", | ||
"3", | ||
"4", | ||
"5", | ||
"6", | ||
"7", | ||
"8", | ||
"9", | ||
"10", | ||
] | ||
`; |
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,28 @@ | ||
export const Bengali = ['০', '১', '২', '৩', '৪', '৫', '৬', '৭', '৮', '৯', '১০']; | ||
export const Burmese = ['၀', '၁', '၂', '၃', '၄', '၅', '၆', '၇', '၈', '၉', '၁၀']; | ||
export const EasternArabic = [ | ||
'۰', | ||
'۱', | ||
'۲', | ||
'۳', | ||
'۴', | ||
'۵', | ||
'۶', | ||
'۷', | ||
'۸', | ||
'۹', | ||
'۱۰', | ||
]; | ||
export const WesternArabic = [ | ||
'0', | ||
'1', | ||
'2', | ||
'3', | ||
'4', | ||
'5', | ||
'6', | ||
'7', | ||
'8', | ||
'9', | ||
'10', | ||
]; |
10 changes: 10 additions & 0 deletions
10
packages/utilities/psammead-locales/src/numerals/index.test.js
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,10 @@ | ||
import * as numerals from '.'; | ||
|
||
describe('Numerals', () => { | ||
const numeralSystems = Object.keys(numerals); | ||
numeralSystems.forEach(numeralSystem => { | ||
it(`should return ${numeralSystem} numerals`, () => { | ||
expect(numerals[numeralSystem]).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |