mirror of
https://github.com/material-components/material-components-ios.git
synced 2026-01-09 07:11:20 +08:00
added shape theming to the scripting generation (#5463)
This add the shape theming doc generation for our components. Same as we did for color, we are adding the shape theming template so then it can be easily generated for our docs. I will generate the shape theming docs for our components in a follow up PR.
This commit is contained in:
parent
f925ce48db
commit
71711cb2df
@ -24,6 +24,15 @@ find components -type d | grep ColorThemer | sort | uniq | while read line; do
|
||||
./scripts/apply_template $component scripts/templates/component/docs/color-theming.md.template components/$component/docs/color-theming.md
|
||||
done
|
||||
|
||||
find components -type d | grep ShapeThemer | sort | uniq | while read line; do
|
||||
component=$(echo "$line" | cut -d'/' -f2)
|
||||
themer=$(echo "$line" | cut -d'/' -f4)
|
||||
|
||||
echo "Generating shape theming documentation for $component..."
|
||||
|
||||
./scripts/apply_template $component scripts/templates/component/docs/shape-theming.md.template components/$component/docs/shape-theming.md
|
||||
done
|
||||
|
||||
find components -type d | grep TypographyThemer | sort | uniq | while read line; do
|
||||
component=$(echo "$line" | cut -d'/' -f2)
|
||||
themer=$(echo "$line" | cut -d'/' -f4)
|
||||
|
||||
@ -53,5 +53,7 @@ the component.
|
||||
<!-- Template: Extensions should be called out separately from Usage docs.
|
||||
|
||||
- [Color Theming](color-theming.md)
|
||||
|
||||
- [Shape Theming](shape-theming.md)
|
||||
-->
|
||||
|
||||
|
||||
37
scripts/templates/component/docs/shape-theming.md.template
Normal file
37
scripts/templates/component/docs/shape-theming.md.template
Normal file
@ -0,0 +1,37 @@
|
||||
### Shape Theming
|
||||
|
||||
You can theme <#a_component_name#> with your app's shape scheme using the ShapeThemer extension.
|
||||
|
||||
You must first add the ShapeThemer extension to your project:
|
||||
|
||||
```bash
|
||||
pod 'MaterialComponents/<#component#>+ShapeThemer'
|
||||
```
|
||||
|
||||
<!--<div class="material-code-render" markdown="1">-->
|
||||
#### Swift
|
||||
```swift
|
||||
// Step 1: Import the ShapeThemer extension
|
||||
import MaterialComponents.Material<#component#>_ShapeThemer
|
||||
|
||||
// Step 2: Create or get a shape scheme
|
||||
let shapeScheme = MDCShapeScheme()
|
||||
|
||||
// Step 3: Apply the shape scheme to your component
|
||||
<#shape_themer_api#>.applyShapeScheme(shapeScheme, to: component)
|
||||
```
|
||||
|
||||
#### Objective-C
|
||||
|
||||
```objc
|
||||
// Step 1: Import the ShapeThemer extension
|
||||
#import "Material<#component#>+ShapeThemer.h"
|
||||
|
||||
// Step 2: Create or get a shape scheme
|
||||
id<MDCShapeScheming> shapeScheme = [[MDCShapeScheme alloc] init];
|
||||
|
||||
// Step 3: Apply the shape scheme to your component
|
||||
[<#shape_themer_api#> applyShapeScheme:shapeScheme
|
||||
to<#themer_parameter_name#>:component];
|
||||
```
|
||||
<!--</div>-->
|
||||
Loading…
x
Reference in New Issue
Block a user