Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename Split to SplitScreen for login page layout #15

Merged
merged 2 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/resources/theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Optional:
- `frame_text_color` (String) The color of the text within the frame in the login page. If the the `layout` is `Frameless`, this color is applied to text within input components on the page. The default value is `#0f0f0f`
- `gradient_background_parameters` (Attributes) The parameters required for a gradient background in the login page (see [below for nested schema](#nestedatt--login_page_theme--gradient_background_parameters))
- `image_background_parameters` (Attributes) The parameters required for an image background in the login page (see [below for nested schema](#nestedatt--login_page_theme--image_background_parameters))
- `layout` (String) The layout of the login page. Options include `Frame`, `Frameless`, and `Split`. The default value is `Frame`
- `layout` (String) The layout of the login page. Options include `Frame`, `Frameless`, and `SplitScreen`. The default value is `Frame`
- `primary_color` (String) The primary color of action buttons and links in the login page. The default value is `#50c878`
- `primary_text_color` (String) The color of the text on action buttons in the login page. The default value is `#f7f7f7`
- `solid_background_parameters` (Attributes) The parameters required for a solid background in the login page (see [below for nested schema](#nestedatt--login_page_theme--solid_background_parameters))
Expand Down
12 changes: 6 additions & 6 deletions internal/provider/theme_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ func (r *themeResource) Schema(ctx context.Context, req resource.SchemaRequest,
Computed: true,
Default: stringdefault.StaticString("Frame"),
Validators: []validator.String{
stringvalidator.OneOf("Frame", "Frameless", "Split"),
stringvalidator.OneOf("Frame", "Frameless", "SplitScreen"),
},
Description: "The layout of the login page. Options include `Frame`, `Frameless`, and `Split`. " +
Description: "The layout of the login page. Options include `Frame`, `Frameless`, and `SplitScreen`. " +
"The default value is `Frame`",
},
"background_type": schema.StringAttribute{
Expand Down Expand Up @@ -535,11 +535,11 @@ func (r *themeResource) ValidateConfig(ctx context.Context, req resource.Validat
}
}

if plan.LoginPageTheme.Layout.ValueString() == "Split" && plan.LoginPageTheme.SplitLoginPageParameters == nil {
if plan.LoginPageTheme.Layout.ValueString() == "SplitScreen" && plan.LoginPageTheme.SplitLoginPageParameters == nil {
resp.Diagnostics.AddAttributeError(
path.Root("login_page_theme"),
"Missing `split_login_page_parameters`",
"`Split` login page layout requires `split_login_page_parameters` to be set",
"`SplitScreen` login page layout requires `split_login_page_parameters` to be set",
)
return
}
Expand Down Expand Up @@ -687,7 +687,7 @@ func convertPlanToTheme(plan *themeResourceModel) *propelauth.Theme {
theme.BackgroundTextColor = convertHexColorToRgb(plan.LoginPageTheme.ImageBackgroundParameters.BackgroundTextColor.ValueString())
}

if plan.LoginPageTheme.Layout.ValueString() == "Split" {
if plan.LoginPageTheme.Layout.ValueString() == "SplitScreen" {
var splitscreenParams propelauth.SplitscreenParams
splitscreenParams.Direction = plan.LoginPageTheme.SplitLoginPageParameters.Direction.ValueString()
splitscreenParams.ContentType = plan.LoginPageTheme.SplitLoginPageParameters.ContentType.ValueString()
Expand Down Expand Up @@ -750,7 +750,7 @@ func updateStateFromTheme(theme propelauth.Theme, state *themeResourceModel) {
}
}

if theme.LoginLayout == "Split" {
if theme.LoginLayout == "SplitScreen" {
state.LoginPageTheme.SplitLoginPageParameters = &splitLoginPageParameters{
Direction: types.StringValue(theme.Splitscreen.Direction),
ContentType: types.StringValue(theme.Splitscreen.ContentType),
Expand Down