diff --git a/scripts/apply_all_templates b/scripts/apply_all_templates index 19fb9990f..1d0619087 100755 --- a/scripts/apply_all_templates +++ b/scripts/apply_all_templates @@ -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) diff --git a/scripts/templates/component/docs/README.md.template b/scripts/templates/component/docs/README.md.template index 5e9375bac..298c0ae7f 100644 --- a/scripts/templates/component/docs/README.md.template +++ b/scripts/templates/component/docs/README.md.template @@ -53,5 +53,7 @@ the component. diff --git a/scripts/templates/component/docs/shape-theming.md.template b/scripts/templates/component/docs/shape-theming.md.template new file mode 100644 index 000000000..e7424dc0f --- /dev/null +++ b/scripts/templates/component/docs/shape-theming.md.template @@ -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' +``` + + +#### 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 shapeScheme = [[MDCShapeScheme alloc] init]; + +// Step 3: Apply the shape scheme to your component +[<#shape_themer_api#> applyShapeScheme:shapeScheme + to<#themer_parameter_name#>:component]; +``` +