-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Theme component with app theme. (#9418)
Added the feature that you can theme components with the app theme by creating a css file in 'frontend/theme/myTheme/components' with the component tag name e.g. 'my-field' should have 'my-field.css' Fixes #9348 # Conflicts: # flow-tests/test-themes-legacy/src/main/java/com/vaadin/flow/uitest/ui/theme/MyComponent.java
- Loading branch information
Showing
8 changed files
with
159 additions
and
2 deletions.
There are no files selected for viewing
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
3 changes: 3 additions & 0 deletions
3
flow-tests/test-themes/frontend/theme/app-theme/components/vaadin-radio-button.css
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,3 @@ | ||
[part='radio'] { | ||
background-color: red; | ||
} |
3 changes: 3 additions & 0 deletions
3
flow-tests/test-themes/frontend/theme/app-theme/components/vaadin-text-field.css
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,3 @@ | ||
[part="input-field"] { | ||
background: red; | ||
} |
42 changes: 42 additions & 0 deletions
42
flow-tests/test-themes/src/main/java/com/vaadin/flow/uitest/ui/theme/MyLitField.java
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,42 @@ | ||
/* | ||
* Copyright 2000-2020 Vaadin Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
package com.vaadin.flow.uitest.ui.theme; | ||
|
||
import com.vaadin.flow.component.Component; | ||
import com.vaadin.flow.component.Tag; | ||
import com.vaadin.flow.component.dependency.JsModule; | ||
import com.vaadin.flow.component.dependency.NpmPackage; | ||
|
||
/** | ||
* LIT version of vaadin radio button for testing component theming. | ||
*/ | ||
@JsModule("@vaadin/vaadin-radio-button/vaadin-radio-button.js") | ||
@Tag("vaadin-radio-button") | ||
@NpmPackage(value = "@vaadin/vaadin-radio-button", version = "2.0.0-alpha1") | ||
public class MyLitField extends Component { | ||
|
||
/** | ||
* Set the component id. | ||
* | ||
* @param id | ||
* value to set | ||
* @return this component | ||
*/ | ||
public Component withId(String id) { | ||
setId(id); | ||
return this; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
flow-tests/test-themes/src/main/java/com/vaadin/flow/uitest/ui/theme/MyPolymerField.java
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,42 @@ | ||
/* | ||
* Copyright 2000-2020 Vaadin Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
package com.vaadin.flow.uitest.ui.theme; | ||
|
||
import com.vaadin.flow.component.Component; | ||
import com.vaadin.flow.component.Tag; | ||
import com.vaadin.flow.component.dependency.JsModule; | ||
import com.vaadin.flow.component.dependency.NpmPackage; | ||
|
||
/** | ||
* Polymer version of vaadin text field for testing component theming. | ||
*/ | ||
@JsModule("@vaadin/vaadin-text-field/vaadin-text-field.js") | ||
@Tag("vaadin-text-field") | ||
@NpmPackage(value="@vaadin/vaadin-text-field", version = "2.7.1") | ||
public class MyPolymerField extends Component { | ||
|
||
/** | ||
* Set the component id. | ||
* | ||
* @param id | ||
* value to set | ||
* @return this component | ||
*/ | ||
public Component withId(String id) { | ||
setId(id); | ||
return this; | ||
} | ||
} |
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