Skip to content

Commit

Permalink
feat: add color semantic tokens (#124) (#198)
Browse files Browse the repository at this point in the history
- Refactor all color semantic tokens with new values available in Figjam
- Update associated unit tests
- Improve documentation

Signed-off-by: Pierre-Yves Lapersonne <[email protected]>
  • Loading branch information
pylapp authored Oct 16, 2024
1 parent 4a3369f commit 1ebf090
Show file tree
Hide file tree
Showing 55 changed files with 4,822 additions and 2,652 deletions.
24 changes: 22 additions & 2 deletions .github/DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,28 @@ Remember _Gitleaks_ is also used in GitHub project side thanks to the [dedicated

We use _SwiftLint_ in this project so as to be sure the source code follows defined guidelines for the syntax and other points.
You must run _SwiftLint_ in CLI or using _Xcode_ to be sure you don't keep and submit warnings.
In most of cases you **must** fiw warnigns, but it could happen some of them should be disabled, mainly for tests cases.
Explain why in yout commtis and pull request comments you choose to disable them.
**In most of cases you must fix warnings, or explain why in your commtis and pull request comments you choose to disable them.**

Today, only in very few cases some SwiftLint warnings are disabled:
- in tests classes
- in files containing tokens which will be generated

The warnings which can be disabled for token files:
- *missing_docs*: because tokens will be generated without documentation by the tokenator
- *identifier_name*: because the name of the tokens are defined in *Figma* and strongly related to the design system
- *line_length*: because tokens definition can take a lot of place
- *file_length*: because the files containing declarations or definitions of tokens can be very long

The warnings which can be disabled for test classes files and mocks files:
- *identifier_name*: because of length of tokens names
- *type_name*: because stringly related to the types under test, which can have a long name
- *line_length*: because of length of tokens names
- *file_length*: because of the amount of tokens to test
- *type_body_length*: because we can have a lot of tests to do
- *required_deinit*: because we do not need to manage init and deinit of test classe
- *implicitly_unwrapped_optional*: because for declaration of themes to test we bang!

Do not forget if possible to enable the warnings in the end of the file to reduce as much as possible the scope of the disabled warnings. Disable warnings only if needed.

## CI/CD

Expand Down
14 changes: 7 additions & 7 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,15 @@ cyclomatic_complexity:
ignores_case_statements: true

file_length:
warning: 800
error: 1000
warning: 500
error: 800

force_cast:
severity: error

function_body_length:
warning: 50
error: 100
error: 80

function_parameter_count:
warning: 6
Expand All @@ -187,8 +187,8 @@ implicit_getter:

identifier_name:
max_length:
warning: 60
error: 80
warning: 40
error: 50
min_length:
warning: 1
allowed_symbols:
Expand Down Expand Up @@ -230,8 +230,8 @@ type_body_length: 250

type_name:
max_length:
warning: 60
error: 80
warning: 40
error: 50
min_length:
warning: 1
allowed_symbols:
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- [Library] Add semantic color tokens ([#124](https://github.com/Orange-OpenSource/ouds-ios/issues/124))
- [DemoApp] Fix some design issues and mutualize some UI elements ([#189](https://github.com/Orange-OpenSource/ouds-ios/issues/189))
- [DemoApp] Add sizing token screen in demo app ([#150](https://github.com/Orange-OpenSource/ouds-ios/issues/150))
- [DemoApp] Add spacing token screen in demo app ([#149](https://github.com/Orange-OpenSource/ouds-ios/issues/149))
Expand All @@ -16,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- [Library] Update of semantic color tokens
- [Library/DemoApp] Updates SwiftLint rules, fix linter warnings ([#143](https://github.com/Orange-OpenSource/ouds-ios/issues/143))
- [Tool] Update the templates for GitHub issues
- [Tool] Improve script for documentation generation ([#168](https://github.com/Orange-OpenSource/ouds-ios/issues/168))
Expand All @@ -36,6 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed

- [Library] Remove all color alias semantic tokens and any optional color tokens type uses
- [Library] `SoshTheme` ([#180](https://github.com/Orange-OpenSource/ouds-ios/issues/180))
- [Library] `fontSizeMobile*`, `fontSizeTablet*`, `fontLineHeightMobile*`, `fontLineHeightTablet*`, `fontLetterSpacingMobile*`, `fontLetterSpacingTablet*` removed (update of October 4th)
- [Library] `spaceRowGapWithIconTaller`, `spaceColumnGapWithIconTaller` removed (update of October 7th)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import OUDSTokensRaw
import OUDSTokensSemantic

// TODO: Check if we can get rid of alias colors tokens which are optional
// swiftlint:disable force_unwrapping

/// Defines for `OUDSButton` the basic configuration which can be overriden in subthemes / subclasses of this theme.
/// **Warning: These are random and dumb values**
Expand All @@ -26,17 +25,15 @@ extension OUDSTheme: ButtonsComponentTokens {
@objc open var buttonInternalSpacing: SpacingPaddingInlineSemanticToken { spacePaddingInlineShort }

@objc open var buttonBorderStyle: BorderStyleSemanticToken { borderStyleDefault }
@objc open var buttonBorderColor: ColorSemanticToken { colorBorderDefault! }
@objc open var buttonBorderColor: ColorSemanticToken { colorBorderDefault }
@objc open var buttonBorderWidth: BorderWidthSemanticToken { borderWidthDefault }
@objc open var buttonBorderRadius: BorderRadiusSemanticToken { borderRadiusShort }

@objc open var buttonForegroundColor: ColorSemanticToken { colorContentBrandPrimary! }
@objc open var buttonBackgroundColor: ColorSemanticToken { colorBackgroundBrandPrimary! }
@objc open var buttonForegroundColor: ColorSemanticToken { colorContentBrandPrimary }
@objc open var buttonBackgroundColor: ColorSemanticToken { colorBackgroundBrandPrimary }

@objc open var buttonWidth: SizingSemanticToken { DimensionRawTokens.dimension3000 }
@objc open var buttonHeight: SizingSemanticToken { DimensionRawTokens.dimension1000 }

@objc open var buttonTypography: MultipleTypographyTokens { typeDisplayMedium }
}

// swiftlint:enable force_unwrapping
Loading

0 comments on commit 1ebf090

Please sign in to comment.