Skip to content

Commit

Permalink
fix: dropdown divider duplicated className with divider component.
Browse files Browse the repository at this point in the history
  • Loading branch information
riccox committed Mar 7, 2023
1 parent 9277cf0 commit 720eb26
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
6 changes: 3 additions & 3 deletions apps/experiments/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,7 @@ <h2 class="text-xl">Others</h2>
<label class="btn solid" tabindex="0">divider</label>
<div class="menu bottom">
<a class="item text-sm">Profile</a>
<div class="divider" role="separator"></div>
<div class="is-divider" role="separator"></div>
<a class="item text-sm" tabindex="-1">Account settings</a>
<a class="item text-sm" tabindex="-1">Subscriptions</a>
</div>
Expand All @@ -1611,7 +1611,7 @@ <h2 class="text-xl">Others</h2>
<label class="btn solid" tabindex="0">subtitle</label>
<div class="menu bottom">
<a class="item text-sm">Profile</a>
<div class="divider" role="separator"></div>
<div class="is-divider" role="separator"></div>
<a class="subtitle">Settings</a>
<a class="item text-sm" tabindex="-1">Account settings</a>
<a class="item text-sm" tabindex="-1">Subscriptions</a>
Expand All @@ -1621,7 +1621,7 @@ <h2 class="text-xl">Others</h2>
<label class="btn solid" tabindex="0">subtitle</label>
<div class="menu bottom">
<a class="item text-sm">Profile</a>
<div class="divider" role="separator"></div>
<div class="is-divider" role="separator"></div>
<a class="subtitle">Settings</a>
<a class="item text-sm" tabindex="-1">Account settings</a>
<a class="item text-sm" tabindex="-1">Subscriptions</a>
Expand Down
2 changes: 1 addition & 1 deletion apps/website/components/demo/dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const DropdownDemo = ({
</label>
<div className={`menu ${position}`}>
<a className="item text-sm">Profile</a>
{divider && <div className="divider" role="separator"></div>}
{divider && <div className="is-divider" role="separator"></div>}
{subtitle && <p className="subtitle">Settings</p>}
<a className="item text-sm" tabIndex={-1}>
Account settings
Expand Down
6 changes: 4 additions & 2 deletions apps/website/pages/docs/components/dropdown.en.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,23 @@ Use the specified value to modify the position of the drop-down list at the `bot
<label class="btn solid" tabindex="0">With Divider</label>
<div class="menu bottom">
<a class="item text-sm">Profile</a>
<div class="divider" role="separator"></div>
<div class="is-divider" role="separator"></div>
<a class="item text-sm" tabindex="-1">Account settings</a>
<a class="item text-sm" tabindex="-1">Subscriptions</a>
</div>
</div>
```

<DropdownDemo position={'right'} labelText={'With Divider'} divider={true} />

## Subtitle

```html
<div class="dropdown success">
<label class="btn solid" tabindex="0">With Divider</label>
<div class="menu bottom">
<a class="item text-sm">Profile</a>
<div class="divider" role="separator"></div>
<div class="is-divider" role="separator"></div>
<p class="subtitle">Settings</p>
<a class="item text-sm" tabindex="-1">Account settings</a>
<a class="item text-sm" tabindex="-1">Subscriptions</a>
Expand Down
6 changes: 4 additions & 2 deletions apps/website/pages/docs/components/dropdown.zh.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,23 @@ import { DropdownDemo } from '../../../components/demo/dropdown';
<label class="btn solid" tabindex="0">With Divider</label>
<div class="menu bottom">
<a class="item text-sm">Profile</a>
<div class="divider" role="separator"></div>
<div class="is-divider" role="separator"></div>
<a class="item text-sm" tabindex="-1">Account settings</a>
<a class="item text-sm" tabindex="-1">Subscriptions</a>
</div>
</div>
```

<DropdownDemo position={'right'} labelText={'With Divider'} divider={true} />

## 小标题

```html
<div class="dropdown success">
<label class="btn solid" tabindex="0">With Divider</label>
<div class="menu bottom">
<a class="item text-sm">Profile</a>
<div class="divider" role="separator"></div>
<div class="is-divider" role="separator"></div>
<p class="subtitle">Settings</p>
<a class="item text-sm" tabindex="-1">Account settings</a>
<a class="item text-sm" tabindex="-1">Subscriptions</a>
Expand Down
4 changes: 2 additions & 2 deletions packages/tailwind/src/style/components/dropdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
color: rgba(var(--sira-color-900), var(--tw-text-opacity));
}

.dropdown > .menu > .divider {
.dropdown > .menu > .is-divider {
@apply relative my-2;
}

.dropdown > .menu > .divider::before {
.dropdown > .menu > .is-divider::before {
--tw-bg-opacity: 0.7;
background-color: rgba(var(--sira-color-500), var(--tw-bg-opacity));
@apply absolute top-0 right-0 h-px w-full scale-x-125 bg-opacity-70 content-[""];
Expand Down

0 comments on commit 720eb26

Please sign in to comment.