-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added some missing class logic to components that have deviated from …
…foundation (#60) # Pull Request ## 📖 Description <!--- Provide some background and a description of your work. --> After doing some re-assessment of added foundation components it was found that a few were missing additional class logic, seemingly related to specific styling, and a few had extra elements baked into the definition. ### 🎫 Issues <!--- List and link relevant issues here using the keyword "closes" if this PR will close an issue, eg. closes #411 --> Related to #31 ## ✅ Checklist ### General <!--- Review the list and put an x in the boxes that apply. --> - [ ] I have added tests for my changes. - [x] I have tested my changes. - [ ] I have updated the project documentation to reflect my changes.
- Loading branch information
Showing
8 changed files
with
157 additions
and
6 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@microsoft-fast-cli-ead87ab3-aaf6-41a4-b224-54bc6e257a28.json
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 @@ | ||
{ | ||
"type": "none", | ||
"comment": "Added some missing class logic to components that have deviated from foundation", | ||
"packageName": "@microsoft/fast-cli", | ||
"email": "7559015+janechu@users.noreply.github.com", | ||
"dependentChangeType": "none" | ||
} |
23 changes: 21 additions & 2 deletions
23
packages/fast-cli/src/components/card/template/component.ts
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 |
---|---|---|
@@ -1,8 +1,27 @@ | ||
import type { ComponentTemplateConfig } from "../../../utilities/template"; | ||
|
||
export default (config: ComponentTemplateConfig): string => | ||
`import { Card } from "@microsoft/fast-foundation"; | ||
`import { composedParent, Card } from "@microsoft/fast-foundation"; | ||
import type { Swatch } from "@microsoft/adaptive-ui/dist/dts/color/swatch.d.js" | ||
import { fillColor, neutralFillLayerRecipe } from "@microsoft/adaptive-ui"; | ||
/** | ||
* A class derived from the Card foundation component | ||
*/ | ||
export class ${config.className} extends Card {};` | ||
export class ${config.className} extends Card { | ||
connectedCallback() { | ||
super.connectedCallback(); | ||
const parent = composedParent(this); | ||
if (parent) { | ||
fillColor.setValueFor( | ||
this, | ||
(target: HTMLElement): Swatch => | ||
neutralFillLayerRecipe | ||
.getValueFor(target) | ||
.evaluate(target, fillColor.getValueFor(parent)) | ||
); | ||
} | ||
} | ||
};` |
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
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