Skip to content

Commit

Permalink
fix: avoid global styles / Garden styles clash
Browse files Browse the repository at this point in the history
  • Loading branch information
Fredx87 committed May 6, 2024
1 parent 2fa52ab commit b5b33c1
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 102 deletions.
13 changes: 1 addition & 12 deletions assets/new-request-form-bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions src/modules/new-request-form/fields/CreditCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ function getLastDigits(value: string): string {
return value ? value.replaceAll("X", "") : "";
}

// override CPH default style. Can be removed once global styles are removed
const StyledMediaInput = styled(MediaInput)`
&:focus {
border: none !important;
}
`;

const DigitsHintSpan = styled(Span)`
margin-left: ${(props) => props.theme.space.xxs};
`;
Expand All @@ -55,7 +48,7 @@ export function CreditCard({ field, onChange }: CreditCardProps): JSX.Element {
{description && (
<Hint dangerouslySetInnerHTML={{ __html: description }} />
)}
<StyledMediaInput
<MediaInput
start={<CreditCardIcon />}
name={name}
type="text"
Expand Down
5 changes: 0 additions & 5 deletions src/modules/new-request-form/fields/cc-field/CcField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ const StyledInput = styled(Input)`
left: 0;
height: var(--line-height);
line-height: var(--line-height);
// override CPH default style. Can be removed once global styles are removed
&:focus {
border: none !important;
}
`;

const AnnouncementMessage = styled.span`
Expand Down
38 changes: 18 additions & 20 deletions style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

104 changes: 54 additions & 50 deletions styles/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,64 +60,68 @@ a {
}
}

input,
textarea {
color: #000;
font-size: $input-font-size;
}

input {
max-width: 100%;
box-sizing: border-box;
transition: $input-transition;

&:not([type="checkbox"]) {
.hbs-form, .search {
input,
textarea {
color: #000;
font-size: $input-font-size;
}

input {
max-width: 100%;
box-sizing: border-box;
transition: $input-transition;

/* We use the :where selector to not increase the specificity of the selector */
&:where(:not([type="checkbox"])) {
outline: none;

&:focus {
border: 1px solid $brand_color;
}
}
}

input[disabled] {
background-color: #ddd;
}

select {
-webkit-appearance: none;
-moz-appearance: none;
background: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23CCC' d='M0 0h10L5 6 0 0z'/%3E%3C/svg%3E%0A")
no-repeat #fff;
background-position: right 10px center;
border: 1px solid $high-contrast-border-color;
border-radius: 4px;
padding: 8px 30px 8px 10px;
outline: none;

color: $field-text-focus-color;
width: 100%;

&:focus {
border: 1px solid $brand_color;
}

&::-ms-expand {
display: none;
}
}
}

input[disabled] {
background-color: #ddd;
}

select {
-webkit-appearance: none;
-moz-appearance: none;
background: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23CCC' d='M0 0h10L5 6 0 0z'/%3E%3C/svg%3E%0A")
no-repeat #fff;
background-position: right 10px center;
border: 1px solid $high-contrast-border-color;
border-radius: 4px;
padding: 8px 30px 8px 10px;
outline: none;
color: $field-text-focus-color;
width: 100%;

&:focus {
border: 1px solid $brand_color;
}

&::-ms-expand {
display: none;

textarea {
border: 1px solid $high-contrast-border-color;
border-radius: 2px;
resize: vertical;
width: 100%;
outline: none;
padding: 10px;

&:focus {
border: 1px solid $brand_color;
}
}
}

textarea {
border: 1px solid $high-contrast-border-color;
border-radius: 2px;
resize: vertical;
width: 100%;
outline: none;
padding: 10px;

&:focus {
border: 1px solid $brand_color;
}
}

.container {
@include max-width-container;
Expand Down
2 changes: 1 addition & 1 deletion styles/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
}
}

.button-large, input[type="submit"] {
.button-large, .hbs-form input[type="submit"] {
@include tablet {
width: auto;
}
Expand Down
2 changes: 1 addition & 1 deletion templates/article_page.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@

{{pagination}}

{{#form 'comment' class='comment-form'}}
{{#form 'comment' class='comment-form hbs-form'}}
<div class="avatar comment-avatar">
{{user_avatar class='user-avatar'}}
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/community_post_page.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@
{{pagination}}

<section class="post-comments">
{{#form 'comment' class='comment-form'}}
{{#form 'comment' class='comment-form hbs-form'}}
<div class="avatar comment-avatar">
{{user_avatar class='user-avatar'}}
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/new_community_post_page.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</h1>

<div id="main-content" class="form">
{{#form 'post' class='new_community_post'}}
{{#form 'post' class='new_community_post hbs-form'}}
<div class="form-field">
{{#required 'title'}}
{{label 'title'}}
Expand Down
4 changes: 2 additions & 2 deletions templates/request_page.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
{{comment_callout}}
</div>

{{#form 'comment' class='comment-form'}}
{{#form 'comment' class='comment-form hbs-form'}}
<div class="avatar comment-avatar">
{{user_avatar class='user-avatar'}}
</div>
Expand Down Expand Up @@ -160,7 +160,7 @@
<dt>{{t 'id'}}</dt>
<dd>#{{request.id}}</dd>

{{#form 'organization' id='request-organization'}}
{{#form 'organization' id='request-organization' class='hbs-form'}}
<dt>{{t 'organization'}}</dt>
<dd>{{select 'organization'}}</dd>
{{/form}}
Expand Down
2 changes: 1 addition & 1 deletion templates/requests_page.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</div>
</header>

{{#form 'requests_filter' id="main-content" class='requests-table-toolbar'}}
{{#form 'requests_filter' id="main-content" class='requests-table-toolbar hbs-form'}}
<div class="search">
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" focusable="false" viewBox="0 0 12 12" class="search-icon" aria-hidden="true">
<circle cx="4.5" cy="4.5" r="4" fill="none" stroke="currentColor"/>
Expand Down

0 comments on commit b5b33c1

Please sign in to comment.