Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR for merging Dev branch against master #108

Merged
merged 50 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
6850794
Bump react-native-paper from 5.11.1 to 5.12.3
dependabot[bot] Feb 1, 2024
b67bcf0
Merge pull request #86 from etn-ccis/dependabot/npm_and_yarn/dev/reac…
surajeaton Feb 1, 2024
f68063c
Bump ip from 1.1.8 to 1.1.9
dependabot[bot] Feb 22, 2024
8290f89
Merge pull request #87 from etn-ccis/dependabot/npm_and_yarn/ip-1.1.9
joebochill Feb 22, 2024
67cf5ff
Bump typescript from 5.2.2 to 5.3.3
dependabot[bot] Mar 1, 2024
9cda1ff
Merge pull request #88 from etn-ccis/dependabot/npm_and_yarn/dev/type…
surajeaton Mar 1, 2024
e7103d8
fix font family and update readme
ektaghag-eaton Mar 28, 2024
ba1becb
update changelog and package version
ektaghag-eaton Mar 29, 2024
bca457e
Merge pull request #90 from etn-ccis/fix/android-text-variant
ektaghag-eaton Apr 1, 2024
766b3e1
Bump typescript from 5.3.3 to 5.4.3
dependabot[bot] Apr 1, 2024
d194dd8
Merge pull request #91 from etn-ccis/dependabot/npm_and_yarn/dev/type…
surajeaton Apr 1, 2024
9f5a937
alpha package 1
manojleaton Apr 11, 2024
fee280a
Merge pull request #92 from etn-ccis/feature/publish-alpha-1
manojleaton Apr 11, 2024
93c1cae
Add blui-ci github workflow
JeffGreiner-eaton Apr 17, 2024
648130a
align indents
JeffGreiner-eaton Apr 17, 2024
91bf4cc
add useFontWeight utility
ektaghag-eaton Apr 17, 2024
8d434a6
add alpha package
ektaghag-eaton Apr 18, 2024
17470b4
revert removal of fontWeight
ektaghag-eaton Apr 18, 2024
101ba10
Merge pull request #94 from etn-ccis/feat/5609-add-font-family-hook
ektaghag-eaton Apr 18, 2024
fe9c5ae
Merge pull request #93 from etn-ccis/feature/blui-5685-github-ci
ektaghag-eaton Apr 18, 2024
1219231
Revert unpublished package
ektaghag-eaton Apr 18, 2024
25b96f4
Merge pull request #95 from etn-ccis/fix/rever-unpublish-package-version
ektaghag-eaton Apr 18, 2024
696e24b
publish failed package
ektaghag-eaton Apr 18, 2024
6f3c036
use setup-node v3
JeffGreiner-eaton Apr 18, 2024
fb91ecf
Merge pull request #96 from etn-ccis/fix/publish-failed-package
JeffGreiner-eaton Apr 18, 2024
3cef264
test npm publish & revert alpha
JeffGreiner-eaton Apr 18, 2024
fa075eb
Merge pull request #97 from etn-ccis/fix/test-npm-publish
JeffGreiner-eaton Apr 18, 2024
84897ac
tests publish alpha
JeffGreiner-eaton Apr 18, 2024
e738e4e
Merge pull request #98 from etn-ccis/fix/test-publish
JeffGreiner-eaton Apr 18, 2024
1624de5
test with new token
JeffGreiner-eaton Apr 18, 2024
7936909
Merge pull request #99 from etn-ccis/fix/test-publish-again
joebochill Apr 18, 2024
4fc6d68
use npm run publish
JeffGreiner-eaton Apr 18, 2024
d9ff9c4
Merge pull request #100 from etn-ccis/fix/test-publish-npm
joebochill Apr 18, 2024
d9e5981
font families are case sensitive
ektaghag-eaton Apr 19, 2024
b402b68
Merge pull request #101 from etn-ccis/fix/font-family-name
ektaghag-eaton Apr 19, 2024
c137b25
fix title large variant font weight
ektaghag-eaton Apr 22, 2024
26015fa
update readme
ektaghag-eaton Apr 22, 2024
36df464
Merge pull request #102 from etn-ccis/fix/title-large-variant
ektaghag-eaton Apr 23, 2024
c233295
update readme code for useFontWeight
ektaghag-eaton Apr 26, 2024
86e83c5
update method name
ektaghag-eaton Apr 26, 2024
895dd1b
Merge pull request #103 from etn-ccis/fix/update-readme-code
surajeaton Apr 26, 2024
8a80913
add build badge & remove reference to circleCI
JeffGreiner-eaton Apr 30, 2024
3733342
Bump typescript from 5.4.3 to 5.4.5
dependabot[bot] May 1, 2024
70c2edc
Merge pull request #105 from etn-ccis/dependabot/npm_and_yarn/dev/typ…
JeffGreiner-eaton May 1, 2024
849fd08
use yarn --immutable
JeffGreiner-eaton May 1, 2024
1357034
Merge pull request #104 from etn-ccis/fix/blui-5710-update-badge
JeffGreiner-eaton May 2, 2024
912fc94
version update
priyankakmEaton May 8, 2024
4c2ef6b
Merge pull request #106 from etn-ccis/task/5589_react-native-themes-v…
priyankakmEaton May 9, 2024
ac91b6d
Release date update
priyankakmEaton May 9, 2024
25ce990
Merge pull request #107 from etn-ccis/task/5589_react_native_themes_r…
JeffGreiner-eaton May 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 0 additions & 65 deletions .circleci/config.yml

This file was deleted.

81 changes: 81 additions & 0 deletions .github/workflows/blui-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Build

on:
push:
branches: [ "dev", "master" ]
pull_request:
branches: [ "dev", "master" ]
pull_request_target:
types:
- opened
branches:
- '*/*'

permissions:
pull-requests: write
contents: read

jobs:
prettier:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- run: yarn install --immutable
- run: yarn prettier:check

build_theme_verify_artifacts:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- run: yarn --immutable
- run: yarn build
- name: Save build
uses: actions/upload-artifact@v3
with:
name: dist
if-no-files-found: error
path: dist
- run: yarn test

publish_react_native_theme:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev') }}
needs: build_theme_verify_artifacts
strategy:
matrix:
node-version: [18.x]
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
BRANCH: ${{ github.ref == 'refs/heads/master' && 'master' || 'dev' }}
steps:
- uses: actions/checkout@v4
- name: Download dist
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
- run: yarn --immutable
- run: npm run publish:package -b ${{env.BRANCH}}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v7.0.1 (May 9, 2024)

### Fixed

- Text variants not working correctly on Android [89](https://github.com/etn-ccis/blui-react-native-themes/issues/89).

## v7.0.0 (January 12, 2024)

### Changed
Expand Down
4 changes: 2 additions & 2 deletions PUBLISHING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Automatic Publishing

This package is published to NPM automatically by CircleCI when code is merged into the `dev` or `master` branches. To publish a new version, simply update the version in `package.json` and merge your code into the appropriate branch.
This package is published to NPM automatically by Github when code is merged into the `dev` or `master` branches. To publish a new version, simply update the version in `package.json` and merge your code into the appropriate branch.

- The `dev` branch will publish versions marked as `alpha` or `beta`.
- The `master` branch will publish any version (`alpha`, `beta`, or `latest`).
Expand All @@ -26,4 +26,4 @@ yarn build
npm adduser && yarn publish:package
```

> Publishing manually should only be done for `alpha` or `beta` packages. The command will work for `latest` packages, but this should be avoided except in rare situations where the automatic publishing functionality is not working in CircleCI.
> Publishing manually should only be done for `alpha` or `beta` packages. The command will work for `latest` packages, but this should be avoided except in rare situations where the automatic publishing functionality is not working in Github.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Brightlayer UI themes for React Native applications

[![](https://img.shields.io/circleci/project/github/etn-ccis/blui-react-native-themes/master.svg?style=flat)](https://circleci.com/gh/etn-ccis/blui-react-native-themes/tree/master)
[![Build](https://github.com/etn-ccis/blui-react-native-themes/actions/workflows/blui-ci.yml/badge.svg?branch=master)](https://github.com/etn-ccis/blui-react-native-themes/actions/workflows/blui-ci.yml)
[![](https://img.shields.io/npm/v/@brightlayer-ui/react-native-themes.svg?label=@brightlayer-ui/react-native-themes&style=flat)](https://www.npmjs.com/package/@brightlayer-ui/react-native-themes)

This package provides [theming](https://brightlayer-ui.github.io/style/themes) support for Eaton applications using the Brightlayer UI design system. It includes resources for developers using React Native with [react-native-paper](https://www.npmjs.com/package/react-native-paper). This package comes with two theme options: a Blue theme (standard) and a Dark theme.
Expand Down Expand Up @@ -55,7 +55,6 @@ import * as BLUIThemes from '@brightlayer-ui/react-native-themes';
</ThemeProvider>
```


### React Native Paper Components Style Override

This Document contains a set of style overrides in components around various [React Native Paper](https://callstack.github.io/react-native-paper/index.html) components.
Expand All @@ -77,6 +76,19 @@ const theme = useExtendedTheme();
</Button>
```

## Usage of useFontWeight hook in your project

When the fontFamily of a Text element in your application needs to be modified, you can use the useFontWeight hook.For instance, to set the fontWeight to "bold", you can utilize the useFontWeight() hook as demonstrated below:

```tsx
import { useFontWeight } from '@brightlayer-ui/react-native-themes';
...
const fontStyleBold = useFontWeight('700');
<Text variant={'headlineLarge'} style={{ ...fontStyleBold }}>
headlineLarge
</Text>
```

### Upgrading from version 6 -> 7

In the version 7, the library has been updated to use [React Native Paper](https://callstack.github.io/react-native-paper/) v5, which is adopting [Material Design 3](https://m3.material.io/). The themes have now been updated to use Material Design 3 Themes.
Expand All @@ -85,4 +97,4 @@ In the version 7, the library has been updated to use [React Native Paper](https
## Demo

[Check it out](https://github.com/etn-ccis/blui-react-native-showcase-demo/tree/master)
-->
-->
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@brightlayer-ui/react-native-themes",
"author": "Brightlayer UI <[email protected]>",
"license": "BSD-3-Clause",
"version": "7.0.0",
"version": "7.0.1",
"description": "React Native themes for Brightlayer UI applications",
"main": "./dist/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ This code is licensed under the BSD-3 license found in the LICENSE file in the r
**/
export { MD3BluiLightTheme as blue } from './blueTheme';
export { MD3BluiDarkTheme as blueDark } from './blueDarkTheme';
export { ExtendedTheme, useExtendedTheme } from './shared';
export { ExtendedTheme, useExtendedTheme, useFontWeight } from './shared';
62 changes: 50 additions & 12 deletions src/shared.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { Platform } from 'react-native';

import { MD3Theme, useTheme } from 'react-native-paper';
import { MD3Type, MD3Typescale } from 'react-native-paper/lib/typescript/types';
import { $DeepPartial } from '@callstack/react-theme-provider';

export const fontConfig = {
displaySmall: {
fontFamily: 'OpenSans-Regular',
fontWeight: '400' as const,
fontSize: 36,
lineHeight: 45,
lineHeight: 48,
},
displayMedium: {
fontFamily: 'OpenSans-Regular',
Expand All @@ -20,37 +19,37 @@ export const fontConfig = {
displayLarge: {
fontFamily: 'OpenSans-Regular',
fontWeight: '400' as const,
fontSize: 54,
lineHeight: 68,
letterSpacing: 1,
fontSize: 57,
lineHeight: 72,
letterSpacing: -0.25,
},
headlineSmall: {
fontFamily: 'OpenSans-Regular',
fontWeight: '500' as const,
fontWeight: '400' as const,
fontSize: 24,
lineHeight: 32,
},
headlineMedium: {
fontFamily: 'OpenSans-Regular',
fontWeight: '500' as const,
fontSize: 27,
lineHeight: 40,
fontWeight: '400' as const,
fontSize: 28,
lineHeight: 36,
},
headlineLarge: {
fontFamily: 'OpenSans-Regular',
fontWeight: '500' as const,
fontWeight: '400' as const,
fontSize: 32,
lineHeight: 40,
},
titleSmall: {
fontFamily: 'OpenSans-Regular',
fontFamily: 'OpenSans-SemiBold',
fontWeight: '600' as const,
fontSize: 14,
lineHeight: 20,
letterSpacing: 0.1,
},
titleMedium: {
fontFamily: 'OpenSans-Regular',
fontFamily: 'OpenSans-SemiBold',
fontWeight: '600' as const,
fontSize: 16,
lineHeight: 24,
Expand Down Expand Up @@ -229,3 +228,42 @@ export type ExtendedTheme = Omit<MD3Theme, 'colors'> & {

export const useExtendedTheme = (overrides?: $DeepPartial<ExtendedTheme>): ExtendedTheme =>
useTheme<ExtendedTheme>(overrides);

export type bluiFontWeight = '300' | '400' | '600' | '700' | '800' | undefined;

export type FontStyle = {
fontFamily: string;
fontWeight: bluiFontWeight;
};

export const useFontWeight = (weight: bluiFontWeight): FontStyle => {
switch (weight) {
case '300':
return {
fontFamily: 'OpenSans-Light',
fontWeight: '300',
};
case '400':
return {
fontFamily: 'OpenSans-Regular',
fontWeight: '400',
};
case '600':
return {
fontFamily: 'OpenSans-SemiBold',
fontWeight: '600',
};
case '700':
return {
fontFamily: 'OpenSans-Bold',
fontWeight: '700',
};
case '800':
return {
fontFamily: 'OpenSans-ExtraBold',
fontWeight: '800',
};
default:
throw new Error(`Invalid font weight: ${weight}`);
}
};
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2175,9 +2175,9 @@ invariant@*, invariant@^2.2.4:
loose-envify "^1.0.0"

ip@^1.1.5:
version "1.1.8"
resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.8.tgz#ae05948f6b075435ed3307acce04629da8cdbf48"
integrity sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==
version "1.1.9"
resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.9.tgz#8dfbcc99a754d07f425310b86a99546b1151e396"
integrity sha512-cyRxvOEpNHNtchU3Ln9KC/auJgup87llfQpQ+t5ghoC/UhL16SWzbueiCsdTnWmqAWl7LadfuwhlqmtOaqMHdQ==

is-arrayish@^0.2.1:
version "0.2.1"
Expand Down Expand Up @@ -3295,9 +3295,9 @@ react-is@^17.0.1:
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==

react-native-paper@^5.0.0:
version "5.11.1"
resolved "https://registry.yarnpkg.com/react-native-paper/-/react-native-paper-5.11.1.tgz#34f612d6fb28099334db08a1bd109086ea91dcac"
integrity sha512-axqRTagGL8LtuYh172cx2Q2THOVJ3PTpPjCKhL5ECRdpJs2ceiboVecSiOIBuO3H7dVpaneptBA0vJr9HeVHwg==
version "5.12.3"
resolved "https://registry.yarnpkg.com/react-native-paper/-/react-native-paper-5.12.3.tgz#d583119722ebbfbb7fe40400181d63748cca3683"
integrity sha512-nH1e1pGPE/aOE5YR2GRX7CfMHFA9cAfrAfgCtwL4amJPDZCoVjc5yt2VDiUE1rT+JUfk0qdICMP3UggxvjMgug==
dependencies:
"@callstack/react-theme-provider" "^3.0.9"
color "^3.1.2"
Expand Down Expand Up @@ -3892,9 +3892,9 @@ type-fest@^0.7.1:
integrity sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==

typescript@^5.0.4:
version "5.2.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78"
integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==
version "5.4.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611"
integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==

uglify-es@^3.1.9:
version "3.3.9"
Expand Down
Loading